@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/types.d.ts
CHANGED
|
@@ -18,17 +18,15 @@ declare module '@neus/sdk' {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Get verification status by proof ID
|
|
21
|
-
* @param qHash -
|
|
22
|
-
* @param auth - Optional authentication for private proofs
|
|
21
|
+
* @param qHash - Proof ID (wire field: qHash)
|
|
23
22
|
* @returns Promise resolving to current status
|
|
24
23
|
*/
|
|
25
|
-
getStatus(qHash: string
|
|
24
|
+
getStatus(qHash: string): Promise<StatusResult>;
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
|
-
* Get private proof status
|
|
29
|
-
* @param qHash -
|
|
30
|
-
* @param wallet -
|
|
31
|
-
* @returns Promise resolving to private proof data
|
|
27
|
+
* Get private proof status (owner-signed)
|
|
28
|
+
* @param qHash - Proof ID (wire field: qHash)
|
|
29
|
+
* @param wallet - Optional injected wallet/provider (MetaMask/ethers Wallet)
|
|
32
30
|
*/
|
|
33
31
|
getPrivateStatus(qHash: string, wallet?: any): Promise<StatusResult>;
|
|
34
32
|
|
|
@@ -41,31 +39,77 @@ declare module '@neus/sdk' {
|
|
|
41
39
|
/** List available verifiers */
|
|
42
40
|
getVerifiers(): Promise<string[]>;
|
|
43
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Poll verification status until completion
|
|
44
|
+
* @param qHash - Proof ID (wire field: qHash)
|
|
45
|
+
* @param options - Polling configuration options
|
|
46
|
+
* @returns Promise resolving to final status
|
|
47
|
+
* @example
|
|
48
|
+
* const finalStatus = await client.pollProofStatus(qHash, {
|
|
49
|
+
* interval: 3000,
|
|
50
|
+
* onProgress: (status) => {
|
|
51
|
+
* // Handle status updates
|
|
52
|
+
* }
|
|
53
|
+
* });
|
|
54
|
+
*/
|
|
55
|
+
pollProofStatus(qHash: string, options?: PollOptions): Promise<StatusResult>;
|
|
56
|
+
|
|
57
|
+
/** Revoke own proof (owner-signed) */
|
|
58
|
+
revokeOwnProof(qHash: string, wallet?: { address: string }): Promise<boolean>;
|
|
59
|
+
|
|
60
|
+
// ═══════════════════════════════════════════════════════════════
|
|
61
|
+
// GATE & LOOKUP METHODS
|
|
62
|
+
// ═══════════════════════════════════════════════════════════════
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get proofs by wallet address
|
|
66
|
+
* @param walletAddress - Target wallet address
|
|
67
|
+
* @param options - Filter options
|
|
68
|
+
* @returns Promise resolving to proofs result
|
|
69
|
+
*/
|
|
70
|
+
getProofsByWallet(walletAddress: string, options?: GetProofsOptions): Promise<ProofsResult>;
|
|
71
|
+
|
|
44
72
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
73
|
+
* Get proofs by wallet or DID (owner access)
|
|
74
|
+
* Requests private proofs using owner signature headers.
|
|
75
|
+
*/
|
|
76
|
+
getPrivateProofsByWallet(walletAddress: string, options?: GetProofsOptions, wallet?: any): Promise<ProofsResult>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Minimal eligibility check against public + discoverable proofs only (API-backed).
|
|
80
|
+
* Prefer this for server-side integrations that do not need full proof payloads.
|
|
81
|
+
*/
|
|
82
|
+
gateCheck(params: GateCheckApiParams): Promise<GateCheckApiResponse>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Non-persistent lookup mode (API-backed, server-side only).
|
|
86
|
+
* Requires Premium API key and does NOT mint/store proofs.
|
|
87
|
+
*/
|
|
88
|
+
lookup(params: LookupParams): Promise<LookupApiResponse>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Evaluate gate requirements against existing proofs
|
|
92
|
+
* Returns whether wallet satisfies all requirements, with missing items listed
|
|
93
|
+
* @param params - Gate check parameters
|
|
94
|
+
* @returns Promise resolving to gate evaluation result
|
|
49
95
|
* @example
|
|
50
|
-
* const
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
96
|
+
* const result = await client.checkGate({
|
|
97
|
+
* walletAddress: '0x...',
|
|
98
|
+
* requirements: [
|
|
99
|
+
* { verifierId: 'nft-ownership', maxAgeMs: 3600000, match: { contractAddress: '0x...' } },
|
|
100
|
+
* { verifierId: 'token-holding', maxAgeMs: 3600000, match: { contractAddress: '0x...' } },
|
|
101
|
+
* ],
|
|
55
102
|
* });
|
|
103
|
+
* if (result.satisfied) { /* allow access *\/ }
|
|
56
104
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/** Revoke own proof (owner-signed) */
|
|
60
|
-
revokeOwnProof(qHash: string, wallet?: { address: string }): Promise<boolean>;
|
|
105
|
+
checkGate(params: CheckGateParams): Promise<CheckGateResult>;
|
|
106
|
+
|
|
61
107
|
}
|
|
62
108
|
|
|
63
|
-
// React widgets have been moved to @neus/widgets package
|
|
64
|
-
|
|
65
109
|
/**
|
|
66
110
|
* Privacy level options for verification data
|
|
67
111
|
*/
|
|
68
|
-
export type PrivacyLevel = 'public' | '
|
|
112
|
+
export type PrivacyLevel = 'public' | 'private';
|
|
69
113
|
|
|
70
114
|
/**
|
|
71
115
|
* Configuration options for NeusClient
|
|
@@ -73,9 +117,11 @@ declare module '@neus/sdk' {
|
|
|
73
117
|
export interface NeusClientConfig {
|
|
74
118
|
/** API endpoint URL (defaults to hosted public API) */
|
|
75
119
|
apiUrl?: string;
|
|
120
|
+
/** Optional premium API key (server-side only; do not embed in browser apps) */
|
|
121
|
+
apiKey?: string;
|
|
76
122
|
/** Request timeout in milliseconds */
|
|
77
123
|
timeout?: number;
|
|
78
|
-
/** Enable
|
|
124
|
+
/** Enable SDK logging */
|
|
79
125
|
enableLogging?: boolean;
|
|
80
126
|
}
|
|
81
127
|
|
|
@@ -89,8 +135,6 @@ declare module '@neus/sdk' {
|
|
|
89
135
|
enableIpfs?: boolean;
|
|
90
136
|
/** Store original content in proof (privacy consideration) */
|
|
91
137
|
storeOriginalContent?: boolean;
|
|
92
|
-
/** Force ZK proof generation (requires partner access) */
|
|
93
|
-
forceZK?: boolean;
|
|
94
138
|
/** Target chains for cross-chain propagation (testnet chains for proof storage) */
|
|
95
139
|
targetChains?: number[];
|
|
96
140
|
/** Allow public display contexts */
|
|
@@ -114,7 +158,7 @@ declare module '@neus/sdk' {
|
|
|
114
158
|
/** Auto path: optional options */
|
|
115
159
|
options?: VerifyOptions;
|
|
116
160
|
|
|
117
|
-
/** Advanced/manual path: list of verifier IDs
|
|
161
|
+
/** Advanced/manual path: list of verifier IDs */
|
|
118
162
|
verifierIds?: VerifierId[];
|
|
119
163
|
/** Advanced/manual path: user's wallet address */
|
|
120
164
|
walletAddress?: string;
|
|
@@ -124,6 +168,10 @@ declare module '@neus/sdk' {
|
|
|
124
168
|
signedTimestamp?: number;
|
|
125
169
|
/** Advanced/manual path: chain ID for verification context; optional, managed by protocol */
|
|
126
170
|
chainId?: number;
|
|
171
|
+
/** Reserved (preview): non-EVM chain context as "namespace:reference" (not part of the stable public path) */
|
|
172
|
+
chain?: string;
|
|
173
|
+
/** Reserved (preview): signature method hint (not part of the stable public path) */
|
|
174
|
+
signatureMethod?: string;
|
|
127
175
|
/** Auto path: optional wallet instance (browser/provider) */
|
|
128
176
|
wallet?: any;
|
|
129
177
|
}
|
|
@@ -132,7 +180,7 @@ declare module '@neus/sdk' {
|
|
|
132
180
|
* Result from proof creation
|
|
133
181
|
*/
|
|
134
182
|
export interface ProofResult {
|
|
135
|
-
/**
|
|
183
|
+
/** Proof ID (qHash) */
|
|
136
184
|
qHash: string;
|
|
137
185
|
/** Current status */
|
|
138
186
|
status: string;
|
|
@@ -148,7 +196,7 @@ declare module '@neus/sdk' {
|
|
|
148
196
|
* Verification result
|
|
149
197
|
*/
|
|
150
198
|
export interface VerificationResult {
|
|
151
|
-
/** Proof
|
|
199
|
+
/** Proof ID (qHash) */
|
|
152
200
|
qHash: string;
|
|
153
201
|
/** Current status */
|
|
154
202
|
status: VerificationStatus;
|
|
@@ -215,13 +263,16 @@ declare module '@neus/sdk' {
|
|
|
215
263
|
};
|
|
216
264
|
options?: {
|
|
217
265
|
enableIpfs?: boolean;
|
|
218
|
-
forceZK?: boolean;
|
|
219
266
|
publicDisplay?: boolean;
|
|
220
267
|
storeOriginalContent?: boolean;
|
|
221
268
|
verifierOptions?: object;
|
|
222
|
-
privacyLevel?: 'private' | '
|
|
269
|
+
privacyLevel?: 'private' | 'public';
|
|
223
270
|
meta?: object;
|
|
224
271
|
};
|
|
272
|
+
meta?: {
|
|
273
|
+
privacyLevel: 'private' | 'public';
|
|
274
|
+
publiclyAccessible: boolean;
|
|
275
|
+
};
|
|
225
276
|
createdAt?: number;
|
|
226
277
|
completedAt?: number;
|
|
227
278
|
lastUpdated?: number;
|
|
@@ -255,18 +306,34 @@ declare module '@neus/sdk' {
|
|
|
255
306
|
}
|
|
256
307
|
|
|
257
308
|
/**
|
|
258
|
-
*
|
|
259
|
-
*
|
|
309
|
+
* Core verifier identifiers
|
|
310
|
+
* Built-in verifier identifiers
|
|
260
311
|
*/
|
|
261
|
-
export type
|
|
312
|
+
export type CoreVerifierId =
|
|
313
|
+
// Public verifiers (auto-path via verify())
|
|
262
314
|
| 'ownership-basic'
|
|
315
|
+
| 'ownership-pseudonym' // Pseudonymous identity verification
|
|
263
316
|
| 'nft-ownership'
|
|
264
317
|
| 'token-holding'
|
|
265
|
-
| 'ownership-
|
|
318
|
+
| 'ownership-dns-txt'
|
|
319
|
+
| 'wallet-link'
|
|
320
|
+
| 'contract-ownership'
|
|
321
|
+
| 'wallet-risk' // Wallet risk assessment
|
|
322
|
+
// AI & Agent verifiers (ERC-8004 aligned)
|
|
323
|
+
| 'agent-identity'
|
|
324
|
+
| 'agent-delegation'
|
|
325
|
+
| 'ai-content-moderation'
|
|
266
326
|
| string; // Allow custom verifier IDs
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Available verifier identifiers (built-in)
|
|
330
|
+
* Alias for CoreVerifierId - use CoreVerifierId for type safety
|
|
331
|
+
* For custom verifiers, use string type with buildVerificationRequest()
|
|
332
|
+
*/
|
|
333
|
+
export type VerifierId = CoreVerifierId;
|
|
267
334
|
|
|
268
335
|
/**
|
|
269
|
-
* Verification status values (
|
|
336
|
+
* Verification status values (standard PROOF_STATUSES)
|
|
270
337
|
*/
|
|
271
338
|
export type VerificationStatus =
|
|
272
339
|
| 'processing_verifiers'
|
|
@@ -313,7 +380,7 @@ declare module '@neus/sdk' {
|
|
|
313
380
|
export function validateTimestamp(timestamp: number, maxAgeMs?: number): boolean;
|
|
314
381
|
|
|
315
382
|
/**
|
|
316
|
-
* Validate qHash format
|
|
383
|
+
* Validate Proof ID (qHash) format
|
|
317
384
|
*/
|
|
318
385
|
export function validateQHash(qHash: string): boolean;
|
|
319
386
|
|
|
@@ -328,7 +395,7 @@ declare module '@neus/sdk' {
|
|
|
328
395
|
export function validateVerifierPayload(verifierId: string, data: any): ValidationResult;
|
|
329
396
|
|
|
330
397
|
/**
|
|
331
|
-
* Build a
|
|
398
|
+
* Build a standard verification request and signing message
|
|
332
399
|
*/
|
|
333
400
|
export function buildVerificationRequest(params: {
|
|
334
401
|
verifierIds: string[];
|
|
@@ -398,20 +465,10 @@ declare module '@neus/sdk' {
|
|
|
398
465
|
}): Promise<T>;
|
|
399
466
|
|
|
400
467
|
/**
|
|
401
|
-
*
|
|
468
|
+
* Proof status
|
|
402
469
|
*/
|
|
403
|
-
|
|
470
|
+
// Use NeusClient.getStatus(qHash) for status checks.
|
|
404
471
|
|
|
405
|
-
/**
|
|
406
|
-
* Check proof status (convenience)
|
|
407
|
-
*/
|
|
408
|
-
export function checkProofStatus(proofId: string): Promise<StatusResult>;
|
|
409
|
-
|
|
410
|
-
// IPFS helpers
|
|
411
|
-
export const IPFS_GATEWAY: string;
|
|
412
|
-
export function toIpfsUrl(cid: string): string;
|
|
413
|
-
export function resolveIpfsUrl(cid: string): string;
|
|
414
|
-
|
|
415
472
|
|
|
416
473
|
// ============================================================================
|
|
417
474
|
// CONSTANTS & REGISTRY
|
|
@@ -421,7 +478,7 @@ declare module '@neus/sdk' {
|
|
|
421
478
|
* NEUS Network constants
|
|
422
479
|
*/
|
|
423
480
|
export const NEUS_CONSTANTS: {
|
|
424
|
-
HUB_CHAIN_ID:
|
|
481
|
+
HUB_CHAIN_ID: number;
|
|
425
482
|
TESTNET_CHAINS: number[];
|
|
426
483
|
API_BASE_URL: string;
|
|
427
484
|
API_VERSION: string;
|
|
@@ -491,26 +548,248 @@ declare module '@neus/sdk' {
|
|
|
491
548
|
|
|
492
549
|
|
|
493
550
|
// ============================================================================
|
|
494
|
-
//
|
|
551
|
+
// GATE & LOOKUP TYPES
|
|
495
552
|
// ============================================================================
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Options for getProofsByWallet
|
|
556
|
+
*/
|
|
557
|
+
export interface GetProofsOptions {
|
|
558
|
+
/** Limit results */
|
|
559
|
+
limit?: number;
|
|
560
|
+
/** Offset for pagination */
|
|
561
|
+
offset?: number;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Result from getProofsByWallet
|
|
566
|
+
*/
|
|
567
|
+
export interface ProofsResult {
|
|
568
|
+
success: boolean;
|
|
569
|
+
proofs: any[];
|
|
570
|
+
totalCount: number;
|
|
571
|
+
hasMore: boolean;
|
|
572
|
+
nextOffset?: number | null;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Single gate requirement
|
|
577
|
+
*/
|
|
578
|
+
export interface GateRequirement {
|
|
579
|
+
/** Verifier ID */
|
|
580
|
+
verifierId: CoreVerifierId;
|
|
581
|
+
/** Maximum age for proof (ms) - if set, proof older than this is expired */
|
|
582
|
+
maxAgeMs?: number;
|
|
583
|
+
/** Is this requirement optional? */
|
|
584
|
+
optional?: boolean;
|
|
585
|
+
/** Minimum count of proofs with this verifier (default: 1) */
|
|
586
|
+
minCount?: number;
|
|
587
|
+
/** Verifier-specific match criteria */
|
|
588
|
+
match?: Record<string, any>;
|
|
506
589
|
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Parameters for checkGate
|
|
593
|
+
*/
|
|
594
|
+
export interface CheckGateParams {
|
|
595
|
+
/** Wallet address to check */
|
|
596
|
+
walletAddress: string;
|
|
597
|
+
/** Gate requirements */
|
|
598
|
+
requirements: GateRequirement[];
|
|
599
|
+
/** Pre-fetched proofs (skip API call) */
|
|
600
|
+
proofs?: any[];
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Result from checkGate
|
|
605
|
+
*/
|
|
606
|
+
export interface CheckGateResult {
|
|
607
|
+
/** All requirements satisfied? */
|
|
608
|
+
satisfied: boolean;
|
|
609
|
+
/** Requirements not met (missing or expired) */
|
|
610
|
+
missing: GateRequirement[];
|
|
611
|
+
/** Existing proofs keyed by verifierId */
|
|
612
|
+
existing: Record<string, any>;
|
|
613
|
+
/** All proofs evaluated */
|
|
614
|
+
allProofs: any[];
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Parameters for gateCheck() (API-backed).
|
|
619
|
+
* Mirrors `GET /api/v1/proofs/gate/check` query parameters.
|
|
620
|
+
*/
|
|
621
|
+
export interface GateCheckApiParams {
|
|
622
|
+
/** Wallet address to check (0x...) */
|
|
623
|
+
address: string;
|
|
624
|
+
/** Verifier IDs to match (array or comma-separated string) */
|
|
625
|
+
verifierIds?: string[] | string;
|
|
626
|
+
/** Require all verifierIds to be present on a single proof */
|
|
627
|
+
requireAll?: boolean;
|
|
628
|
+
/** Minimum number of matching proofs (default: 1) */
|
|
629
|
+
minCount?: number;
|
|
630
|
+
/** Optional time window in days */
|
|
631
|
+
sinceDays?: number;
|
|
632
|
+
/** Optional unix timestamp in milliseconds (lower bound) */
|
|
633
|
+
since?: number;
|
|
634
|
+
/** Max rows to scan (server may clamp) */
|
|
635
|
+
limit?: number;
|
|
636
|
+
|
|
637
|
+
// Common match filters
|
|
638
|
+
referenceType?: string;
|
|
639
|
+
referenceId?: string;
|
|
640
|
+
tag?: string;
|
|
641
|
+
tags?: string[] | string;
|
|
642
|
+
contentType?: string;
|
|
643
|
+
content?: string;
|
|
644
|
+
contentHash?: string;
|
|
645
|
+
|
|
646
|
+
// Asset/ownership filters
|
|
647
|
+
contractAddress?: string;
|
|
648
|
+
tokenId?: string;
|
|
649
|
+
chainId?: number;
|
|
650
|
+
domain?: string;
|
|
651
|
+
minBalance?: string;
|
|
652
|
+
|
|
653
|
+
// Social / wallet filters
|
|
654
|
+
provider?: string;
|
|
655
|
+
handle?: string;
|
|
656
|
+
ownerAddress?: string;
|
|
657
|
+
riskLevel?: string;
|
|
658
|
+
sanctioned?: boolean;
|
|
659
|
+
poisoned?: boolean;
|
|
660
|
+
primaryWalletAddress?: string;
|
|
661
|
+
secondaryWalletAddress?: string;
|
|
662
|
+
verificationMethod?: string;
|
|
663
|
+
|
|
664
|
+
// Trait checks + projections
|
|
665
|
+
traitPath?: string;
|
|
666
|
+
traitGte?: number;
|
|
667
|
+
/** Comma-separated projection fields (handle,provider,profileUrl,traits.<key>) */
|
|
668
|
+
select?: string[] | string;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export interface GateCheckApiResponse {
|
|
672
|
+
success: boolean;
|
|
673
|
+
data?: {
|
|
674
|
+
eligible: boolean;
|
|
675
|
+
matchedCount?: number;
|
|
676
|
+
matchedQHashes?: string[];
|
|
677
|
+
matchedTags?: string[];
|
|
678
|
+
projections?: Array<Record<string, any>> | null;
|
|
679
|
+
criteria?: Record<string, any>;
|
|
680
|
+
};
|
|
681
|
+
error?: any;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Parameters for lookup() (API-backed).
|
|
686
|
+
* Mirrors `POST /api/v1/verification/lookup` body.
|
|
687
|
+
*/
|
|
688
|
+
export interface LookupParams {
|
|
689
|
+
/** Premium API key (sk_live_... or sk_test_...) */
|
|
690
|
+
apiKey: string;
|
|
691
|
+
/** Verifiers to run (external_lookup only) */
|
|
692
|
+
verifierIds: string[];
|
|
693
|
+
/** Wallet to evaluate */
|
|
694
|
+
targetWalletAddress: string;
|
|
695
|
+
/** Verifier input data (e.g., contractAddress/tokenId/chainId) */
|
|
696
|
+
data?: Record<string, any>;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export interface LookupApiResponse {
|
|
700
|
+
success: boolean;
|
|
701
|
+
data?: {
|
|
702
|
+
mode: 'lookup';
|
|
703
|
+
requestId: string;
|
|
704
|
+
targetWalletAddress: string;
|
|
705
|
+
payerWallet: string;
|
|
706
|
+
verifierIds: string[];
|
|
707
|
+
verified: boolean;
|
|
708
|
+
results: any[];
|
|
709
|
+
timing?: {
|
|
710
|
+
startedAt: number;
|
|
711
|
+
durationMs: number;
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
error?: any;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
export interface ApiResponse<T = any> {
|
|
718
|
+
success: boolean;
|
|
719
|
+
data?: T;
|
|
720
|
+
error?: any;
|
|
721
|
+
status?: string;
|
|
722
|
+
timestamp?: number;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// ============================================================================
|
|
726
|
+
// GATE RECIPE EXPORTS (Examples, NOT defaults)
|
|
727
|
+
// ============================================================================
|
|
728
|
+
|
|
729
|
+
/** Time constant: 1 hour in milliseconds */
|
|
730
|
+
export const HOUR: number;
|
|
731
|
+
/** Time constant: 1 day in milliseconds */
|
|
732
|
+
export const DAY: number;
|
|
733
|
+
/** Time constant: 1 week in milliseconds */
|
|
734
|
+
export const WEEK: number;
|
|
735
|
+
/** Time constant: 1 month (30 days) in milliseconds */
|
|
736
|
+
export const MONTH: number;
|
|
737
|
+
/** Time constant: 1 year (365 days) in milliseconds */
|
|
738
|
+
export const YEAR: number;
|
|
739
|
+
|
|
740
|
+
/** NFT holder gate (add match.contractAddress when using) */
|
|
741
|
+
export const GATE_NFT_HOLDER: GateRequirement[];
|
|
742
|
+
/** Token holder gate (add match.contractAddress, minBalance when using) */
|
|
743
|
+
export const GATE_TOKEN_HOLDER: GateRequirement[];
|
|
744
|
+
/** Contract admin gate: requires recent contract ownership (1h TTL) */
|
|
745
|
+
export const GATE_CONTRACT_ADMIN: GateRequirement[];
|
|
746
|
+
/** Domain owner gate: requires DNS TXT verification */
|
|
747
|
+
export const GATE_DOMAIN_OWNER: GateRequirement[];
|
|
748
|
+
/** Linked wallets gate: requires wallet linking */
|
|
749
|
+
export const GATE_LINKED_WALLETS: GateRequirement[];
|
|
750
|
+
/** Agent identity gate: requires verified agent identity */
|
|
751
|
+
export const GATE_AGENT_IDENTITY: GateRequirement[];
|
|
752
|
+
/** Agent delegation gate: requires delegation proof (7-day TTL) */
|
|
753
|
+
export const GATE_AGENT_DELEGATION: GateRequirement[];
|
|
754
|
+
/** Content moderation gate: requires recent moderation proof */
|
|
755
|
+
export const GATE_CONTENT_MODERATION: GateRequirement[];
|
|
756
|
+
/** Wallet risk gate: provider-backed risk signal */
|
|
757
|
+
export const GATE_WALLET_RISK: GateRequirement[];
|
|
758
|
+
/** Pseudonym gate: requires pseudonymous identity proof */
|
|
759
|
+
export const GATE_PSEUDONYM: GateRequirement[];
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Create a custom gate from verifier IDs or requirement objects
|
|
763
|
+
* @param requirements - Array of verifier IDs or requirement objects
|
|
764
|
+
*/
|
|
765
|
+
export function createGate(
|
|
766
|
+
requirements: Array<CoreVerifierId | GateRequirement>
|
|
767
|
+
): GateRequirement[];
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Combine multiple gates (union of requirements)
|
|
771
|
+
* @param gates - Gate arrays to combine
|
|
772
|
+
*/
|
|
773
|
+
export function combineGates(
|
|
774
|
+
...gates: GateRequirement[][]
|
|
775
|
+
): GateRequirement[];
|
|
776
|
+
|
|
777
|
+
// ============================================================================
|
|
778
|
+
// SUPPORTING TYPES
|
|
779
|
+
// ============================================================================
|
|
507
780
|
|
|
508
781
|
interface VerificationData {
|
|
509
782
|
content?: string;
|
|
510
783
|
owner: string;
|
|
511
784
|
reference?: {
|
|
512
785
|
type: string;
|
|
513
|
-
|
|
786
|
+
/** Optional reference identifier (required only for reference-only proofs). */
|
|
787
|
+
id?: string;
|
|
788
|
+
title?: string;
|
|
789
|
+
description?: string;
|
|
790
|
+
mime?: string;
|
|
791
|
+
name?: string;
|
|
792
|
+
size?: number;
|
|
514
793
|
};
|
|
515
794
|
[key: string]: any;
|
|
516
795
|
}
|
|
@@ -523,23 +802,58 @@ declare module '@neus/sdk' {
|
|
|
523
802
|
/** Store sanitized snapshot on IPFS */
|
|
524
803
|
enableIpfs?: boolean;
|
|
525
804
|
/** Privacy level for public exposure and IPFS snapshots */
|
|
526
|
-
privacyLevel?: 'private' | '
|
|
527
|
-
/**
|
|
805
|
+
privacyLevel?: 'private' | 'public';
|
|
806
|
+
/** Allow public display contexts (UI showcases) */
|
|
528
807
|
publicDisplay?: boolean;
|
|
529
|
-
/**
|
|
808
|
+
/** Include full original content in IPFS snapshot (only when privacy is public) */
|
|
530
809
|
storeOriginalContent?: boolean;
|
|
531
|
-
/** Metadata for public presentation and
|
|
810
|
+
/** Metadata for public presentation, attribution, and discovery */
|
|
532
811
|
meta?: {
|
|
533
|
-
|
|
812
|
+
// Core display
|
|
813
|
+
title?: string;
|
|
814
|
+
description?: string;
|
|
815
|
+
displayName?: string;
|
|
816
|
+
contentText?: string;
|
|
817
|
+
// Content metadata
|
|
534
818
|
contentType?: string;
|
|
535
819
|
contentDescription?: string;
|
|
820
|
+
// Legal & licensing
|
|
821
|
+
license?: string;
|
|
536
822
|
publicContentLicense?: string;
|
|
537
823
|
publicContentDisclaimer?: string;
|
|
824
|
+
legal?: string;
|
|
825
|
+
// Attribution & campaigns
|
|
826
|
+
source?: string;
|
|
827
|
+
campaign?: string;
|
|
828
|
+
// Categorization
|
|
538
829
|
tags?: string[];
|
|
539
|
-
|
|
830
|
+
category?: string;
|
|
831
|
+
};
|
|
832
|
+
/** Reference to external content or file */
|
|
833
|
+
reference?: {
|
|
834
|
+
type:
|
|
835
|
+
| 'ipfs'
|
|
836
|
+
| 'ipfs-hash'
|
|
837
|
+
| 'url'
|
|
838
|
+
| 'license-nft'
|
|
839
|
+
| 'contract'
|
|
840
|
+
| 'qhash'
|
|
841
|
+
| 'ethereum-tx'
|
|
842
|
+
| 'on-chain-tx'
|
|
843
|
+
| 'tx'
|
|
844
|
+
| 'file'
|
|
845
|
+
| 'doc'
|
|
846
|
+
| 'media'
|
|
847
|
+
| 'username-claim'
|
|
848
|
+
| 'other';
|
|
849
|
+
/** Optional reference identifier (required only for reference-only proofs). */
|
|
850
|
+
id?: string;
|
|
851
|
+
title?: string;
|
|
852
|
+
description?: string;
|
|
853
|
+
mime?: string;
|
|
854
|
+
name?: string;
|
|
855
|
+
size?: number;
|
|
540
856
|
};
|
|
541
|
-
/** Force ZK when supported by verifier (requires partner access) */
|
|
542
|
-
forceZK?: boolean;
|
|
543
857
|
/** Verifier-specific overrides */
|
|
544
858
|
verifierOptions?: Record<string, any>;
|
|
545
859
|
/** Optional user-presentable identity overrides */
|
|
@@ -547,4 +861,138 @@ declare module '@neus/sdk' {
|
|
|
547
861
|
}
|
|
548
862
|
|
|
549
863
|
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
declare module '@neus/sdk/widgets' {
|
|
867
|
+
export interface VerifyGateProps {
|
|
868
|
+
/** Array of verifier IDs required for access */
|
|
869
|
+
requiredVerifiers?: string[];
|
|
870
|
+
/** Callback when verification completes successfully */
|
|
871
|
+
onVerified?: (result: {
|
|
872
|
+
qHash: string;
|
|
873
|
+
qHashes?: string[];
|
|
874
|
+
address?: string;
|
|
875
|
+
txHash?: string | null;
|
|
876
|
+
verifierIds: string[];
|
|
877
|
+
verifiedVerifiers?: any[];
|
|
878
|
+
statusUrl?: string | null;
|
|
879
|
+
existing?: boolean;
|
|
880
|
+
mode?: 'create' | 'access';
|
|
881
|
+
data?: any;
|
|
882
|
+
results?: Array<{
|
|
883
|
+
verifierId: string;
|
|
884
|
+
qHash: string;
|
|
885
|
+
address?: string;
|
|
886
|
+
txHash?: string | null;
|
|
887
|
+
verifiedVerifiers?: any[];
|
|
888
|
+
statusUrl?: string | null;
|
|
889
|
+
}>;
|
|
890
|
+
proofsByVerifierId?: Record<string, any>;
|
|
891
|
+
}) => void;
|
|
892
|
+
/** Custom API endpoint URL */
|
|
893
|
+
apiUrl?: string;
|
|
894
|
+
/** Custom inline styles */
|
|
895
|
+
style?: Record<string, any>;
|
|
896
|
+
/** Child content to show when verified */
|
|
897
|
+
children?: any;
|
|
898
|
+
/** Verifier-specific options */
|
|
899
|
+
verifierOptions?: Record<string, any>;
|
|
900
|
+
/** Pre-built verifier data for each verifier */
|
|
901
|
+
verifierData?: Record<string, any>;
|
|
902
|
+
/** Proof creation options (privacyLevel, publicDisplay, storeOriginalContent) */
|
|
903
|
+
proofOptions?: Record<string, any>;
|
|
904
|
+
/** Proof reuse strategy */
|
|
905
|
+
strategy?: 'reuse-or-create' | 'reuse' | 'fresh';
|
|
906
|
+
/** Check for existing proofs before verification */
|
|
907
|
+
checkExisting?: boolean;
|
|
908
|
+
/** Optional max age override (ms) for proof reuse */
|
|
909
|
+
maxProofAgeMs?: number;
|
|
910
|
+
/** Allow owner-signed lookups for private proof reuse */
|
|
911
|
+
allowPrivateReuse?: boolean;
|
|
912
|
+
/** Show NEUS branding */
|
|
913
|
+
showBrand?: boolean;
|
|
914
|
+
/** Disable interaction */
|
|
915
|
+
disabled?: boolean;
|
|
916
|
+
/** Custom button text */
|
|
917
|
+
buttonText?: string;
|
|
918
|
+
/** Mode: 'create' for new verification, 'access' for private proof access */
|
|
919
|
+
mode?: 'create' | 'access';
|
|
920
|
+
/** qHash for private proof access (required when mode='access') */
|
|
921
|
+
qHash?: string | null;
|
|
922
|
+
/** Callback for state changes */
|
|
923
|
+
onStateChange?: (state: string) => void;
|
|
924
|
+
/** Callback for errors */
|
|
925
|
+
onError?: (error: Error) => void;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export function VerifyGate(props: VerifyGateProps): any;
|
|
929
|
+
|
|
930
|
+
export interface ProofBadgeProps {
|
|
931
|
+
/** Proof ID (qHash) */
|
|
932
|
+
qHash: string;
|
|
933
|
+
/** Badge size */
|
|
934
|
+
size?: 'sm' | 'md';
|
|
935
|
+
/** UI platform base URL */
|
|
936
|
+
uiLinkBase?: string;
|
|
937
|
+
/** API base URL for status fetching */
|
|
938
|
+
apiUrl?: string;
|
|
939
|
+
/** Optional proof object to skip API fetch */
|
|
940
|
+
proof?: any;
|
|
941
|
+
/** Show chain count */
|
|
942
|
+
showChains?: boolean;
|
|
943
|
+
/** Show status label (default: true) */
|
|
944
|
+
showLabel?: boolean;
|
|
945
|
+
/** Custom click handler */
|
|
946
|
+
onClick?: (data: { qHash: string; status: string; chainCount?: number }) => void;
|
|
947
|
+
/** Additional CSS class */
|
|
948
|
+
className?: string;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
export function ProofBadge(props: ProofBadgeProps): any;
|
|
952
|
+
|
|
953
|
+
export interface SimpleProofBadgeProps {
|
|
954
|
+
qHash: string;
|
|
955
|
+
uiLinkBase?: string;
|
|
956
|
+
apiUrl?: string;
|
|
957
|
+
size?: 'sm' | 'md';
|
|
958
|
+
/** Label text (default: 'Verified') */
|
|
959
|
+
label?: string;
|
|
960
|
+
proof?: any;
|
|
961
|
+
onClick?: (data: { qHash: string; status: string }) => void;
|
|
962
|
+
className?: string;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
export function SimpleProofBadge(props: SimpleProofBadgeProps): any;
|
|
966
|
+
|
|
967
|
+
export interface NeusPillLinkProps {
|
|
968
|
+
qHash?: string;
|
|
969
|
+
uiLinkBase?: string;
|
|
970
|
+
label?: string;
|
|
971
|
+
size?: 'sm' | 'md';
|
|
972
|
+
onClick?: (data: { qHash?: string }) => void;
|
|
973
|
+
className?: string;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export function NeusPillLink(props: NeusPillLinkProps): any;
|
|
977
|
+
|
|
978
|
+
export interface VerifiedIconProps {
|
|
979
|
+
/** Proof ID (qHash) for link */
|
|
980
|
+
qHash?: string;
|
|
981
|
+
/** UI platform base URL */
|
|
982
|
+
uiLinkBase?: string;
|
|
983
|
+
/** Icon size in pixels */
|
|
984
|
+
size?: number;
|
|
985
|
+
/** Tooltip text */
|
|
986
|
+
tooltip?: string;
|
|
987
|
+
/** Custom click handler */
|
|
988
|
+
onClick?: (data: { qHash?: string }) => void;
|
|
989
|
+
/** Additional CSS class */
|
|
990
|
+
className?: string;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
export function VerifiedIcon(props: VerifiedIconProps): any;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
declare module '@neus/sdk/widgets/verify-gate' {
|
|
997
|
+
export * from '@neus/sdk/widgets';
|
|
550
998
|
}
|