@neus/sdk 1.1.5 → 1.1.7

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/package.json CHANGED
@@ -1,147 +1,150 @@
1
- {
2
- "name": "@neus/sdk",
3
- "version": "1.1.5",
4
- "description": "NEUS makes trust portable across the internet — so people, apps, and AI agents can prove what is real before access, payout, or execution.",
5
- "bin": {
6
- "neus": "cli/neus.mjs"
7
- },
8
- "main": "index.js",
9
- "type": "module",
10
- "types": "types.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./types.d.ts",
14
- "import": "./index.js",
15
- "require": "./cjs/index.cjs"
16
- },
17
- "./client": {
18
- "types": "./types.d.ts",
19
- "import": "./client.js",
20
- "require": "./cjs/client.cjs"
21
- },
22
- "./utils": {
23
- "import": "./utils.js",
24
- "require": "./cjs/utils.cjs"
25
- },
26
- "./errors": {
27
- "import": "./errors.js",
28
- "require": "./cjs/errors.cjs"
29
- },
30
- "./gates": {
31
- "import": "./gates.js",
32
- "require": "./cjs/gates.cjs"
33
- },
34
- "./mcp-hosts": {
35
- "import": "./mcp-hosts.js",
36
- "require": "./cjs/mcp-hosts.cjs"
37
- },
38
- "./widgets": {
39
- "types": "./types.d.ts",
40
- "import": "./widgets/index.js",
41
- "require": "./widgets.cjs"
42
- },
43
- "./widgets/verify-gate": {
44
- "types": "./types.d.ts",
45
- "import": "./widgets/verify-gate/index.js",
46
- "require": "./widgets.cjs"
47
- }
48
- },
49
- "sideEffects": false,
50
- "scripts": {
51
- "test": "npm run build:cjs && vitest run",
52
- "test:coverage": "vitest run --coverage",
53
- "lint": "eslint . --ignore-pattern widgets/verify-gate/dist/**",
54
- "format": "prettier --write \"**/*.js\"",
55
- "build": "npm run build:widgets && npm run build:cjs",
56
- "build:widgets": "npx 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",
57
- "build:cjs": "npx esbuild index.js client.js utils.js errors.js gates.js mcp-hosts.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",
58
- "prepack": "npm run build",
59
- "prepublishOnly": "npm run lint && npm test && npm run build"
60
- },
61
- "keywords": [
62
- "neus",
63
- "verification",
64
- "cryptographic-proofs",
65
- "identity",
66
- "authentication",
67
- "blockchain",
68
- "cross-chain",
69
- "web3",
70
- "passwordless",
71
- "universal-protocol",
72
- "proof",
73
- "ownership",
74
- "sdk",
75
- "mcp",
76
- "model-context-protocol",
77
- "oauth"
78
- ],
79
- "author": "NEUS Network",
80
- "license": "Apache-2.0",
81
- "repository": {
82
- "type": "git",
83
- "url": "git+https://github.com/neus/network.git",
84
- "directory": "sdk"
85
- },
86
- "bugs": {
87
- "url": "https://github.com/neus/network/issues"
88
- },
89
- "homepage": "https://neus.network",
90
- "publishConfig": {
91
- "access": "public",
92
- "registry": "https://registry.npmjs.org"
93
- },
94
- "engines": {
95
- "node": ">=20.0.0"
96
- },
97
- "peerDependencies": {
98
- "ethers": "^6.0.0",
99
- "react": ">=17.0.0",
100
- "react-dom": ">=17.0.0"
101
- },
102
- "peerDependenciesMeta": {
103
- "@zkpassport/sdk": {
104
- "optional": true
105
- },
106
- "react": {
107
- "optional": true
108
- },
109
- "react-dom": {
110
- "optional": true
111
- }
112
- },
113
- "optionalDependencies": {
114
- "@zkpassport/sdk": "^0.14.0"
115
- },
116
- "dependencies": {
117
- "bs58": "^6.0.0"
118
- },
119
- "devDependencies": {
120
- "@vitest/coverage-v8": "^4.1.3",
121
- "esbuild": "^0.28.0",
122
- "eslint": "^8.56.0",
123
- "eslint-plugin-react": "^7.37.2",
124
- "prettier": "^3.2.0",
125
- "vitest": "^4.1.3"
126
- },
127
- "files": [
128
- "cli/neus.mjs",
129
- "mcp-hosts.js",
130
- "index.js",
131
- "client.js",
132
- "utils.js",
133
- "errors.js",
134
- "gates.js",
135
- "sponsor.js",
136
- "cjs/**",
137
- "widgets.cjs",
138
- "types.d.ts",
139
- "README.md",
140
- "SECURITY.md",
141
- "LICENSE",
142
- "widgets/index.js",
143
- "widgets/verify-gate/index.js",
144
- "widgets/verify-gate/dist/VerifyGate.js",
145
- "widgets/verify-gate/dist/ProofBadge.js"
146
- ]
147
- }
1
+ {
2
+ "name": "@neus/sdk",
3
+ "version": "1.1.7",
4
+ "description": "NEUS makes trust portable across the internet — so people, apps, and AI agents can prove what is real before access, payout, or execution.",
5
+ "bin": {
6
+ "neus": "cli/neus.mjs"
7
+ },
8
+ "main": "index.js",
9
+ "type": "module",
10
+ "types": "types.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./types.d.ts",
14
+ "import": "./index.js",
15
+ "require": "./cjs/index.cjs"
16
+ },
17
+ "./client": {
18
+ "types": "./types.d.ts",
19
+ "import": "./client.js",
20
+ "require": "./cjs/client.cjs"
21
+ },
22
+ "./utils": {
23
+ "import": "./utils.js",
24
+ "require": "./cjs/utils.cjs"
25
+ },
26
+ "./errors": {
27
+ "import": "./errors.js",
28
+ "require": "./cjs/errors.cjs"
29
+ },
30
+ "./gates": {
31
+ "import": "./gates.js",
32
+ "require": "./cjs/gates.cjs"
33
+ },
34
+ "./mcp-hosts": {
35
+ "import": "./mcp-hosts.js",
36
+ "require": "./cjs/mcp-hosts.cjs"
37
+ },
38
+ "./widgets": {
39
+ "types": "./types.d.ts",
40
+ "import": "./widgets/index.js",
41
+ "require": "./widgets.cjs"
42
+ },
43
+ "./widgets/verify-gate": {
44
+ "types": "./types.d.ts",
45
+ "import": "./widgets/verify-gate/index.js",
46
+ "require": "./widgets.cjs"
47
+ }
48
+ },
49
+ "sideEffects": false,
50
+ "scripts": {
51
+ "test": "npm run build:cjs && vitest run",
52
+ "test:coverage": "vitest run --coverage",
53
+ "lint": "eslint . --ignore-pattern widgets/verify-gate/dist/**",
54
+ "format": "prettier --write \"**/*.js\"",
55
+ "build": "npm run build:widgets && npm run build:cjs",
56
+ "build:widgets": "npx 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",
57
+ "build:cjs": "npx esbuild index.js client.js utils.js errors.js gates.js mcp-hosts.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",
58
+ "prepack": "npm run build",
59
+ "prepublishOnly": "npm run lint && npm test && npm run build"
60
+ },
61
+ "keywords": [
62
+ "neus",
63
+ "verification",
64
+ "cryptographic-proofs",
65
+ "identity",
66
+ "authentication",
67
+ "blockchain",
68
+ "cross-chain",
69
+ "web3",
70
+ "passwordless",
71
+ "universal-protocol",
72
+ "proof",
73
+ "ownership",
74
+ "sdk",
75
+ "mcp",
76
+ "model-context-protocol",
77
+ "oauth"
78
+ ],
79
+ "author": "NEUS Network",
80
+ "license": "Apache-2.0",
81
+ "repository": {
82
+ "type": "git",
83
+ "url": "git+https://github.com/neus/network.git",
84
+ "directory": "sdk"
85
+ },
86
+ "bugs": {
87
+ "url": "https://github.com/neus/network/issues"
88
+ },
89
+ "homepage": "https://neus.network",
90
+ "publishConfig": {
91
+ "access": "public",
92
+ "registry": "https://registry.npmjs.org"
93
+ },
94
+ "engines": {
95
+ "node": ">=20.0.0"
96
+ },
97
+ "peerDependencies": {
98
+ "ethers": "^6.0.0",
99
+ "react": ">=17.0.0",
100
+ "react-dom": ">=17.0.0"
101
+ },
102
+ "peerDependenciesMeta": {
103
+ "@zkpassport/sdk": {
104
+ "optional": true
105
+ },
106
+ "react": {
107
+ "optional": true
108
+ },
109
+ "react-dom": {
110
+ "optional": true
111
+ }
112
+ },
113
+ "optionalDependencies": {
114
+ "@zkpassport/sdk": "^0.14.0"
115
+ },
116
+ "overrides": {
117
+ "ws": "8.21.0"
118
+ },
119
+ "dependencies": {
120
+ "bs58": "^6.0.0"
121
+ },
122
+ "devDependencies": {
123
+ "@vitest/coverage-v8": "^4.1.3",
124
+ "esbuild": "^0.28.0",
125
+ "eslint": "^8.56.0",
126
+ "eslint-plugin-react": "^7.37.2",
127
+ "prettier": "^3.2.0",
128
+ "vitest": "^4.1.3"
129
+ },
130
+ "files": [
131
+ "cli/neus.mjs",
132
+ "mcp-hosts.js",
133
+ "index.js",
134
+ "client.js",
135
+ "utils.js",
136
+ "errors.js",
137
+ "gates.js",
138
+ "sponsor.js",
139
+ "cjs/**",
140
+ "widgets.cjs",
141
+ "types.d.ts",
142
+ "README.md",
143
+ "SECURITY.md",
144
+ "LICENSE",
145
+ "widgets/index.js",
146
+ "widgets/verify-gate/index.js",
147
+ "widgets/verify-gate/dist/VerifyGate.js",
148
+ "widgets/verify-gate/dist/ProofBadge.js"
149
+ ]
150
+ }
package/types.d.ts CHANGED
@@ -51,6 +51,12 @@
51
51
 
52
52
  checkGate(params: CheckGateParams): Promise<CheckGateResult>;
53
53
 
54
+ /** Public gate snapshot (requirements, charge, schedule — never the secret reward value). */
55
+ getGate(gateId: string): Promise<PublicGateSnapshot>;
56
+
57
+ /** Post-verify reward delivery for hosted gate checkout (session or wallet-bound). */
58
+ fulfillGate(params: FulfillGateParams): Promise<GateFulfillmentResponse>;
59
+
54
60
  }
55
61
 
56
62
  export type PrivacyLevel = 'public' | 'private';
@@ -102,6 +108,8 @@
102
108
  enableIpfs?: boolean;
103
109
  storeOriginalContent?: boolean;
104
110
  targetChains?: number[];
111
+ /** Anchor the receipt on the hub registry chain. Defaults to false (receipts persist offchain). */
112
+ publishToHub?: boolean;
105
113
  publicDisplay?: boolean;
106
114
  meta?: Record<string, any>;
107
115
  verifierOptions?: Record<string, any>;
@@ -429,12 +437,102 @@
429
437
  scheme: string;
430
438
  label: string;
431
439
  amountUsd: number;
432
- methods: string[];
440
+ /** Payment methods offered to visitors: 'usdc' and/or 'stripe' (card). */
441
+ methods: Array<'usdc' | 'stripe' | string>;
442
+ /** True when the owner can receive card payouts (Stripe Connect ready). */
443
+ cardPayoutReady?: boolean;
433
444
  appliesTo: string;
445
+ /** 'verifyThenCharge' (default) or 'chargeThenVerify'. */
434
446
  executionOrder?: string;
435
447
  recipient?: string;
436
448
  };
437
449
 
450
+ /** One gate requirement row on the wire (protocol shape used by published gates). */
451
+ export interface GateMatchRowWire {
452
+ path: string;
453
+ op?: 'eq' | 'gte' | 'lte' | string;
454
+ value: string;
455
+ }
456
+
457
+ export interface GateRequirementWire {
458
+ verifierId: string;
459
+ match?: GateMatchRowWire[];
460
+ optional?: boolean;
461
+ minCount?: number;
462
+ maxAgeMs?: number;
463
+ }
464
+
465
+ /** Public snapshot returned by GET /api/v1/profile/gates/{gateId} — never includes the secret reward value. */
466
+ export interface PublicGateSnapshot {
467
+ schemaVersion: number;
468
+ gateId: string;
469
+ name?: string;
470
+ status?: string;
471
+ version?: number;
472
+ requirements: GateRequirementWire[];
473
+ policy?: {
474
+ visibility?: string;
475
+ gateFreshnessHours?: number;
476
+ };
477
+ monetization?: {
478
+ charge?: NeusPublicGateCharge | null;
479
+ };
480
+ checkout?: {
481
+ mode?: string;
482
+ flowPlan?: {
483
+ batches?: number;
484
+ hasInteractive?: boolean;
485
+ hasBackground?: boolean;
486
+ };
487
+ description?: string;
488
+ successReturnUrl?: string;
489
+ };
490
+ marketplaceTemplate?: {
491
+ templateId: string;
492
+ label?: string;
493
+ tags?: string[];
494
+ };
495
+ schedule?: {
496
+ startsAt?: string;
497
+ endsAt?: string;
498
+ };
499
+ artifact?: {
500
+ type: string;
501
+ label?: string;
502
+ };
503
+ }
504
+
505
+ export interface FulfillGateParams {
506
+ gateId: string;
507
+ /** Verified proof receipt id for this checkout. */
508
+ qHash: string;
509
+ /** Required when no session cookie binds the wallet. */
510
+ walletAddress?: string;
511
+ /** Stripe checkout session id for paid gates (card rail). */
512
+ paymentCheckoutSessionId?: string;
513
+ /** USDC payment transaction hash for paid gates (wallet rail). */
514
+ paymentTxHash?: string;
515
+ }
516
+
517
+ export interface GateFulfillmentResult {
518
+ delivery: 'access_granted' | 'redirect' | 'download' | 'reveal' | string;
519
+ type?: string;
520
+ value?: string;
521
+ label?: string;
522
+ message?: string;
523
+ }
524
+
525
+ export interface GateFulfillmentResponse {
526
+ success: boolean;
527
+ data?: {
528
+ gateId: string;
529
+ qHash: string;
530
+ fulfillment: GateFulfillmentResult;
531
+ successReturnUrl?: string;
532
+ };
533
+ error?: any;
534
+ }
535
+
438
536
  export const NEUS_CONSTANTS: {
439
537
  HUB_CHAIN_ID: number;
440
538
  TESTNET_CHAINS: number[];
@@ -482,16 +580,36 @@
482
580
  cursor?: string;
483
581
  chain?: string;
484
582
  signatureMethod?: string;
583
+ q?: string;
584
+ qHash?: string;
585
+ verifierId?: string;
586
+ verifierIds?: string;
587
+ tags?: string;
588
+ tagPrefix?: string;
589
+ tagContains?: string;
590
+ tagPrefixesAll?: string;
591
+ status?: string;
592
+ appId?: string;
593
+ chainCoverage?: 'hub-only' | 'cross-chain';
594
+ privacyLevel?: 'public' | 'private';
595
+ includeHistory?: boolean;
596
+ includeFacets?: string;
597
+ visibility?: 'public';
598
+ isPublicRead?: boolean;
485
599
  }
486
600
 
487
601
  export interface ProofsResult {
488
602
  success: boolean;
489
603
  proofs: any[];
490
- totalCount: number;
604
+ totalCount: number | null;
491
605
  hasMore: boolean;
492
606
  nextOffset?: number | null;
493
607
  /** Keyset continuation when the API returns cursor paging (preferred over deep offsets). */
494
608
  nextCursor?: string | null;
609
+ facets?: {
610
+ tags?: string[];
611
+ truncated?: boolean;
612
+ } | null;
495
613
  }
496
614
 
497
615
  export interface GateRequirement {
@@ -499,7 +617,11 @@
499
617
  maxAgeMs?: number;
500
618
  optional?: boolean;
501
619
  minCount?: number;
502
- match?: Record<string, any>;
620
+ /**
621
+ * Either the protocol wire shape (array of { path, op, value } rows — what
622
+ * published gates store) or a flat { path: value } map for client-side checks.
623
+ */
624
+ match?: GateMatchRowWire[] | Record<string, any>;
503
625
  }
504
626
 
505
627
  export interface CheckGateParams {
@@ -577,6 +699,25 @@
577
699
  matchedTags?: string[];
578
700
  projections?: Array<Record<string, any>> | null;
579
701
  criteria?: Record<string, any>;
702
+ /**
703
+ * Per-requirement gate evaluation — present whenever `gateId` was passed.
704
+ * `allRequiredSatisfied === true` is the ONLY readiness signal for gate
705
+ * checkout; `eligible`/`matchedCount` alone are not sufficient.
706
+ */
707
+ gate?: {
708
+ gateId: string | null;
709
+ allRequiredSatisfied: boolean;
710
+ satisfiedVerifierIds: string[];
711
+ missingVerifierIds: string[];
712
+ /** verifierId → qHash map for `options.reusedVerifierProofs` on submit (requires includeQHashes=true). */
713
+ reusedVerifierProofs?: Record<string, string>;
714
+ /** Per-requirement rows (requires includeQHashes=true). */
715
+ rows?: Array<{
716
+ verifierId: string;
717
+ satisfied: boolean;
718
+ qHashes?: string[];
719
+ }>;
720
+ };
580
721
  };
581
722
  error?: any;
582
723
  }
@@ -830,6 +971,8 @@
830
971
 
831
972
  interface VerifyOptions {
832
973
  targetChains?: number[];
974
+ /** Anchor the receipt on the hub registry chain. Defaults to false (receipts persist offchain). */
975
+ publishToHub?: boolean;
833
976
  enableIpfs?: boolean;
834
977
  privacyLevel?: 'private' | 'public';
835
978
  publicDisplay?: boolean;