sm-crypto-v2 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js DELETED
@@ -1,97 +0,0 @@
1
- module.exports = {
2
- 'extends': [
3
- 'airbnb-base',
4
- 'plugin:promise/recommended'
5
- ],
6
- 'parserOptions': {
7
- 'ecmaVersion': 9,
8
- 'ecmaFeatures': {
9
- 'jsx': false
10
- },
11
- 'sourceType': 'module'
12
- },
13
- 'env': {
14
- 'es6': true,
15
- 'node': true,
16
- 'jest': true
17
- },
18
- 'plugins': [
19
- 'import',
20
- 'node',
21
- 'promise'
22
- ],
23
- 'rules': {
24
- 'arrow-parens': 'off',
25
- 'comma-dangle': [
26
- 'error',
27
- 'only-multiline'
28
- ],
29
- 'complexity': ['error', 20],
30
- 'func-names': 'off',
31
- 'global-require': 'off',
32
- 'handle-callback-err': [
33
- 'error',
34
- '^(err|error)$'
35
- ],
36
- 'import/no-unresolved': [
37
- 'error',
38
- {
39
- 'caseSensitive': true,
40
- 'commonjs': true,
41
- 'ignore': ['^[^.]']
42
- }
43
- ],
44
- 'import/prefer-default-export': 'off',
45
- 'linebreak-style': 'off',
46
- 'no-catch-shadow': 'error',
47
- 'no-continue': 'off',
48
- 'no-div-regex': 'warn',
49
- 'no-else-return': 'off',
50
- 'no-param-reassign': 'off',
51
- 'no-plusplus': 'off',
52
- 'no-shadow': 'off',
53
- 'no-multi-assign': 'off',
54
- 'no-underscore-dangle': 'off',
55
- 'node/no-deprecated-api': 'error',
56
- 'node/process-exit-as-throw': 'error',
57
- 'object-curly-spacing': [
58
- 'error',
59
- 'never'
60
- ],
61
- 'operator-linebreak': [
62
- 'error',
63
- 'after',
64
- {
65
- 'overrides': {
66
- ':': 'before',
67
- '?': 'before'
68
- }
69
- }
70
- ],
71
- 'prefer-arrow-callback': 'off',
72
- 'prefer-destructuring': 'off',
73
- 'prefer-template': 'off',
74
- 'quote-props': [
75
- 1,
76
- 'as-needed',
77
- {
78
- 'unnecessary': true
79
- }
80
- ],
81
- 'semi': [
82
- 'error',
83
- 'never'
84
- ],
85
- 'max-len': 'off',
86
- 'no-bitwise': 'off',
87
- 'no-mixed-operators': 'off',
88
- },
89
- 'globals': {
90
- 'window': true,
91
- 'document': true,
92
- 'App': true,
93
- 'Page': true,
94
- 'Component': true,
95
- 'Behavior': true
96
- }
97
- }
@@ -1,17 +0,0 @@
1
- # .github/workflows/test.yml
2
- name: Test
3
- on: [push, pull_request, workflow_dispatch]
4
- jobs:
5
- test:
6
- runs-on: ubuntu-latest
7
- steps:
8
- # Your original steps
9
- - uses: actions/checkout@v3
10
- - uses: actions/setup-node@v3
11
- - name: Install
12
- run: npm install
13
- - name: Test and Coverage
14
- run: npm run coverage # or npm run coverage
15
- # Add this
16
- - name: Update Coverage Badge
17
- uses: we-cli/coverage-badge-action@main
@@ -1,29 +0,0 @@
1
- import { run, mark, utils } from 'micro-bmark';
2
- import * as sm from 'sm-crypto'
3
- import * as smV2 from 'sm-crypto-v2'
4
-
5
- const msg = 'Hello world~!'
6
-
7
- const keypair = smV2.sm2.generateKeyPairHex('12345678901234567890')
8
-
9
- run(async () => {
10
- await smV2.sm2.initRNGPool()
11
- const sig = smV2.sm2.doSignature(msg, keypair.privateKey, { publicKey: keypair.publicKey})
12
-
13
- const RAM = false
14
- console.log();
15
- if (RAM) utils.logMem();
16
- console.log('=== sm-crypto ===')
17
- await mark('sm2 generateKeyPair', 100, () => sm.sm2.generateKeyPairHex())
18
- await mark('sm2 encrypt', 500, () => sm.sm2.doEncrypt(msg, keypair.publicKey));
19
- await mark('sm2 sign', 500, () => sm.sm2.doSignature(msg, keypair.privateKey, { publicKey: keypair.publicKey}));
20
- await mark('sm2 verify', 500, () => sm.sm2.doVerifySignature(msg, sig, keypair.publicKey));
21
- if (RAM) utils.logMem();
22
- if (RAM) utils.logMem();
23
- console.log('=== sm-crypto-v2 ===')
24
- await mark('sm2 generateKeyPair', 100, () => smV2.sm2.generateKeyPairHex())
25
- await mark('sm2 encrypt', 500, () => smV2.sm2.doEncrypt(msg, keypair.publicKey));
26
- await mark('sm2 sign', 500, () => smV2.sm2.doSignature(msg, keypair.privateKey, { publicKey: keypair.publicKey}));
27
- await mark('sm2 verify', 500, () => smV2.sm2.doVerifySignature(msg, sig, keypair.publicKey));
28
- if (RAM) utils.logMem();
29
- });
@@ -1,19 +0,0 @@
1
- {
2
- "name": "benchmark",
3
- "private": true,
4
- "version": "0.1.0",
5
- "description": "benchmarks",
6
- "main": "index.js",
7
- "type": "module",
8
- "scripts": {
9
- "bench": "node index.js"
10
- },
11
- "keywords": [],
12
- "author": "",
13
- "license": "MIT",
14
- "dependencies": {
15
- "micro-bmark": "^0.3.1",
16
- "sm-crypto": "^0.3.12",
17
- "sm-crypto-v2": "^1.2.2"
18
- }
19
- }
@@ -1,28 +0,0 @@
1
- lockfileVersion: '6.0'
2
-
3
- dependencies:
4
- micro-bmark:
5
- specifier: ^0.3.1
6
- version: 0.3.1
7
- sm-crypto:
8
- specifier: ^0.3.12
9
- version: 0.3.12
10
- sm-crypto-v2:
11
- specifier: ^1.2.2
12
- version: link:..
13
-
14
- packages:
15
-
16
- /jsbn@1.1.0:
17
- resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==}
18
- dev: false
19
-
20
- /micro-bmark@0.3.1:
21
- resolution: {integrity: sha512-bNaKObD4yPAAPrpEqp5jO6LJ2sEFgLoFSmRjEY809mJ62+2AehI/K3+RlVpN3Oo92RHpgC2RQhj6b1Tb4dmo+w==}
22
- dev: false
23
-
24
- /sm-crypto@0.3.12:
25
- resolution: {integrity: sha512-272PBzB4PYaBdeGa41TH9ZlMGLPVRmS36Gs4FjmHwXIdihQypAbhhFWZTaa/3de69q2KfMme1M5O2W5+spAdrg==}
26
- dependencies:
27
- jsbn: 1.1.0
28
- dev: false