@neus/sdk 1.0.0 → 1.0.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/LICENSE +36 -40
- package/README.md +86 -152
- package/SECURITY.md +29 -224
- package/cjs/client.cjs +1686 -0
- package/cjs/errors.cjs +202 -0
- package/cjs/gates.cjs +140 -0
- package/cjs/index.cjs +2315 -0
- package/cjs/utils.cjs +620 -0
- package/client.js +1693 -844
- package/errors.js +223 -228
- package/gates.js +175 -0
- package/index.js +21 -26
- package/package.json +68 -18
- package/types.d.ts +519 -71
- package/utils.js +752 -722
- package/widgets/README.md +53 -0
- package/widgets/index.js +9 -0
- package/widgets/verify-gate/dist/ProofBadge.js +355 -0
- package/widgets/verify-gate/dist/VerifyGate.js +601 -0
- package/widgets/verify-gate/index.js +13 -0
- package/widgets.cjs +20 -0
package/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* NEUS SDK - Universal Verification Protocol
|
|
3
|
-
* Create and verify cryptographic proofs across applications
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
1
|
+
// NEUS SDK - Create and verify cryptographic proofs
|
|
6
2
|
|
|
7
3
|
// Core client
|
|
8
4
|
export { NeusClient } from './client.js';
|
|
@@ -32,10 +28,24 @@ export {
|
|
|
32
28
|
NEUS_CONSTANTS
|
|
33
29
|
} from './utils.js';
|
|
34
30
|
|
|
35
|
-
//
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
// Gate recipes (examples, NOT defaults - pick what fits your use case)
|
|
32
|
+
export {
|
|
33
|
+
// Time constants
|
|
34
|
+
HOUR,
|
|
35
|
+
DAY,
|
|
36
|
+
WEEK,
|
|
37
|
+
MONTH,
|
|
38
|
+
YEAR,
|
|
39
|
+
// Recipe gates
|
|
40
|
+
GATE_NFT_HOLDER,
|
|
41
|
+
GATE_TOKEN_HOLDER,
|
|
42
|
+
GATE_CONTRACT_ADMIN,
|
|
43
|
+
GATE_DOMAIN_OWNER,
|
|
44
|
+
GATE_LINKED_WALLETS,
|
|
45
|
+
// Helpers
|
|
46
|
+
createGate,
|
|
47
|
+
combineGates,
|
|
48
|
+
} from './gates.js';
|
|
39
49
|
|
|
40
50
|
// Error classes
|
|
41
51
|
export {
|
|
@@ -48,23 +58,8 @@ export {
|
|
|
48
58
|
AuthenticationError
|
|
49
59
|
} from './errors.js';
|
|
50
60
|
|
|
51
|
-
// Convenience functions
|
|
52
|
-
export const verifyProof = async qHash => {
|
|
53
|
-
const { NeusClient } = await import('./client.js');
|
|
54
|
-
const client = new NeusClient();
|
|
55
|
-
return client.getStatus(qHash);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const checkProofStatus = async proofId => {
|
|
59
|
-
const { NeusClient } = await import('./client.js');
|
|
60
|
-
const client = new NeusClient();
|
|
61
|
-
return client.getStatus(proofId);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
61
|
// Default export
|
|
65
62
|
export default {
|
|
66
63
|
NeusClient: () => import('./client.js').then(m => m.NeusClient),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
resolveIpfsUrl
|
|
70
|
-
};
|
|
64
|
+
toString: () => '[neus/sdk]'
|
|
65
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neus/sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "NEUS SDK - Create and verify cryptographic proofs with
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "NEUS SDK - Create and verify cryptographic proofs with simple, clean API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "types.d.ts",
|
|
@@ -9,22 +9,49 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./types.d.ts",
|
|
11
11
|
"import": "./index.js",
|
|
12
|
-
"require": "./index.
|
|
12
|
+
"require": "./cjs/index.cjs"
|
|
13
13
|
},
|
|
14
|
-
"./client":
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
"./client": {
|
|
15
|
+
"import": "./client.js",
|
|
16
|
+
"require": "./cjs/client.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./utils": {
|
|
19
|
+
"import": "./utils.js",
|
|
20
|
+
"require": "./cjs/utils.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./errors": {
|
|
23
|
+
"import": "./errors.js",
|
|
24
|
+
"require": "./cjs/errors.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./gates": {
|
|
27
|
+
"import": "./gates.js",
|
|
28
|
+
"require": "./cjs/gates.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./widgets": {
|
|
31
|
+
"types": "./types.d.ts",
|
|
32
|
+
"import": "./widgets/index.js",
|
|
33
|
+
"require": "./widgets.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./widgets/verify-gate": {
|
|
36
|
+
"types": "./types.d.ts",
|
|
37
|
+
"import": "./widgets/verify-gate/index.js",
|
|
38
|
+
"require": "./widgets.cjs"
|
|
39
|
+
}
|
|
17
40
|
},
|
|
18
41
|
"sideEffects": false,
|
|
19
42
|
"scripts": {
|
|
20
43
|
"test": "vitest run",
|
|
21
|
-
"test:
|
|
22
|
-
"
|
|
23
|
-
"lint": "eslint *.js",
|
|
44
|
+
"test:coverage": "vitest run --coverage",
|
|
45
|
+
"lint": "eslint . --ignore-pattern widgets/verify-gate/dist/**",
|
|
24
46
|
"format": "prettier --write \"**/*.js\"",
|
|
25
|
-
"
|
|
47
|
+
"build": "npm run build:widgets && npm run build:cjs",
|
|
48
|
+
"build:widgets": "esbuild widgets/verify-gate/VerifyGate.jsx widgets/verify-gate/ProofBadge.jsx --bundle --platform=browser --format=esm --outdir=widgets/verify-gate/dist --jsx=automatic --legal-comments=none --external:react --external:react-dom --external:react/jsx-runtime --external:@neus/sdk/client",
|
|
49
|
+
"build:cjs": "esbuild index.js client.js utils.js errors.js gates.js --bundle --platform=node --format=cjs --outdir=cjs --out-extension:.js=.cjs --legal-comments=none --external:ethers --external:@zkpassport/sdk --external:react --external:react-dom --external:react/jsx-runtime",
|
|
50
|
+
"prepack": "npm run build",
|
|
51
|
+
"prepublishOnly": "npm run lint && npm test && npm run build"
|
|
26
52
|
},
|
|
27
53
|
"keywords": [
|
|
54
|
+
"neus",
|
|
28
55
|
"verification",
|
|
29
56
|
"cryptographic-proofs",
|
|
30
57
|
"identity",
|
|
@@ -33,11 +60,13 @@
|
|
|
33
60
|
"cross-chain",
|
|
34
61
|
"web3",
|
|
35
62
|
"passwordless",
|
|
36
|
-
"universal-protocol"
|
|
63
|
+
"universal-protocol",
|
|
64
|
+
"proof",
|
|
65
|
+
"ownership",
|
|
66
|
+
"sdk"
|
|
37
67
|
],
|
|
38
68
|
"author": "NEUS Network",
|
|
39
69
|
"license": "Apache-2.0",
|
|
40
|
-
"publishConfig": { "access": "public" },
|
|
41
70
|
"repository": {
|
|
42
71
|
"type": "git",
|
|
43
72
|
"url": "git+https://github.com/neus/network.git",
|
|
@@ -48,28 +77,49 @@
|
|
|
48
77
|
},
|
|
49
78
|
"homepage": "https://neus.network",
|
|
50
79
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
80
|
+
"node": ">=16.0.0"
|
|
52
81
|
},
|
|
53
82
|
"dependencies": {},
|
|
54
83
|
"peerDependencies": {
|
|
55
|
-
"ethers": "^6.0.0"
|
|
84
|
+
"ethers": "^6.0.0",
|
|
85
|
+
"react": ">=17.0.0",
|
|
86
|
+
"react-dom": ">=17.0.0"
|
|
87
|
+
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"@zkpassport/sdk": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"react": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"react-dom": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"optionalDependencies": {
|
|
100
|
+
"@zkpassport/sdk": ">=1.0.0"
|
|
56
101
|
},
|
|
57
102
|
"devDependencies": {
|
|
58
103
|
"vitest": "^1.2.0",
|
|
59
104
|
"@vitest/coverage-v8": "^1.2.0",
|
|
60
105
|
"eslint": "^8.56.0",
|
|
61
106
|
"prettier": "^3.2.0",
|
|
62
|
-
"
|
|
63
|
-
"ethers": "^6.0.0"
|
|
107
|
+
"esbuild": "^0.20.2"
|
|
64
108
|
},
|
|
65
109
|
"files": [
|
|
66
110
|
"index.js",
|
|
67
111
|
"client.js",
|
|
68
112
|
"utils.js",
|
|
69
113
|
"errors.js",
|
|
114
|
+
"gates.js",
|
|
115
|
+
"cjs/**",
|
|
116
|
+
"widgets.cjs",
|
|
70
117
|
"types.d.ts",
|
|
71
118
|
"README.md",
|
|
119
|
+
"SECURITY.md",
|
|
72
120
|
"LICENSE",
|
|
73
|
-
"
|
|
121
|
+
"widgets/index.js",
|
|
122
|
+
"widgets/verify-gate/index.js",
|
|
123
|
+
"widgets/verify-gate/dist/**"
|
|
74
124
|
]
|
|
75
|
-
}
|
|
125
|
+
}
|