@neus/sdk 1.0.12 → 1.1.0
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/CHANGELOG.md +3 -0
- package/README.md +37 -39
- package/cjs/client.cjs +50 -20
- package/cjs/index.cjs +50 -20
- package/cli/neus.mjs +1205 -118
- package/client.js +59 -29
- package/package.json +10 -2
- package/types.d.ts +61 -13
- package/widgets/verify-gate/dist/ProofBadge.js +8 -16
- package/widgets/verify-gate/dist/VerifyGate.js +8 -10
package/client.js
CHANGED
|
@@ -239,6 +239,17 @@ const validateVerifierData = (verifierId, data) => {
|
|
|
239
239
|
if (data.agentType && !['ai', 'bot', 'service', 'automation', 'agent'].includes(data.agentType)) {
|
|
240
240
|
return { valid: false, error: 'agentType must be one of: ai, bot, service, automation, agent' };
|
|
241
241
|
}
|
|
242
|
+
if (data.defaultRuntime && typeof data.defaultRuntime === 'object') {
|
|
243
|
+
if (data.defaultRuntime.provider && typeof data.defaultRuntime.provider === 'string' && data.defaultRuntime.provider.length > 64) {
|
|
244
|
+
return { valid: false, error: 'defaultRuntime.provider must be 64 chars or less' };
|
|
245
|
+
}
|
|
246
|
+
if (data.defaultRuntime.model && typeof data.defaultRuntime.model === 'string' && data.defaultRuntime.model.length > 128) {
|
|
247
|
+
return { valid: false, error: 'defaultRuntime.model must be 128 chars or less' };
|
|
248
|
+
}
|
|
249
|
+
if (data.defaultRuntime.mode && typeof data.defaultRuntime.mode === 'string' && data.defaultRuntime.mode.length > 64) {
|
|
250
|
+
return { valid: false, error: 'defaultRuntime.mode must be 64 chars or less' };
|
|
251
|
+
}
|
|
252
|
+
}
|
|
242
253
|
break;
|
|
243
254
|
case 'agent-delegation':
|
|
244
255
|
if (!data.controllerWallet || !validateWalletAddress(data.controllerWallet)) {
|
|
@@ -253,6 +264,18 @@ const validateVerifierData = (verifierId, data) => {
|
|
|
253
264
|
if (data.expiresAt && (typeof data.expiresAt !== 'number' || data.expiresAt < Date.now())) {
|
|
254
265
|
return { valid: false, error: 'expiresAt must be a future timestamp' };
|
|
255
266
|
}
|
|
267
|
+
if (data.model && typeof data.model === 'string' && data.model.length > 128) {
|
|
268
|
+
return { valid: false, error: 'model must be 128 chars or less' };
|
|
269
|
+
}
|
|
270
|
+
if (data.provider && typeof data.provider === 'string' && data.provider.length > 64) {
|
|
271
|
+
return { valid: false, error: 'provider must be 64 chars or less' };
|
|
272
|
+
}
|
|
273
|
+
if (data.allowedActions && Array.isArray(data.allowedActions) && data.allowedActions.length > 32) {
|
|
274
|
+
return { valid: false, error: 'allowedActions must have 32 items or less' };
|
|
275
|
+
}
|
|
276
|
+
if (data.deniedActions && Array.isArray(data.deniedActions) && data.deniedActions.length > 32) {
|
|
277
|
+
return { valid: false, error: 'deniedActions must have 32 items or less' };
|
|
278
|
+
}
|
|
256
279
|
break;
|
|
257
280
|
case 'ai-content-moderation':
|
|
258
281
|
if (!data.content || typeof data.content !== 'string') {
|
|
@@ -457,12 +480,12 @@ export class NeusClient {
|
|
|
457
480
|
throw new ConfigurationError('Invalid wallet provider');
|
|
458
481
|
}
|
|
459
482
|
|
|
460
|
-
_getDefaultBrowserWallet() {
|
|
461
|
-
if (typeof window === 'undefined') return null;
|
|
462
|
-
// Legacy convenience fallback only. Non-EVM wallets must be passed explicitly
|
|
463
|
-
// with CAIP-2 chain context so the SDK does not route them through EVM RPC.
|
|
464
|
-
return window.ethereum || null;
|
|
465
|
-
}
|
|
483
|
+
_getDefaultBrowserWallet() {
|
|
484
|
+
if (typeof window === 'undefined') return null;
|
|
485
|
+
// Legacy convenience fallback only. Non-EVM wallets must be passed explicitly
|
|
486
|
+
// with CAIP-2 chain context so the SDK does not route them through EVM RPC.
|
|
487
|
+
return window.ethereum || null;
|
|
488
|
+
}
|
|
466
489
|
|
|
467
490
|
async _buildPrivateGateAuth({ address, wallet, chain, signatureMethod } = {}) {
|
|
468
491
|
const providerWallet = wallet || this._getDefaultBrowserWallet();
|
|
@@ -732,10 +755,10 @@ export class NeusClient {
|
|
|
732
755
|
walletAddress = Array.isArray(accounts) && accounts.length > 0 ? accounts[0] : null;
|
|
733
756
|
}
|
|
734
757
|
}
|
|
735
|
-
} else {
|
|
736
|
-
if (typeof window === 'undefined' || !window.ethereum) {
|
|
737
|
-
throw new ConfigurationError('No EVM browser wallet detected. Provide wallet explicitly for non-EVM flows and include chain as a CAIP-2 value.');
|
|
738
|
-
}
|
|
758
|
+
} else {
|
|
759
|
+
if (typeof window === 'undefined' || !window.ethereum) {
|
|
760
|
+
throw new ConfigurationError('No EVM browser wallet detected. Provide wallet explicitly for non-EVM flows and include chain as a CAIP-2 value.');
|
|
761
|
+
}
|
|
739
762
|
await window.ethereum.request({ method: 'eth_requestAccounts' });
|
|
740
763
|
provider = window.ethereum;
|
|
741
764
|
const accounts = await provider.request({ method: 'eth_accounts' });
|
|
@@ -852,9 +875,13 @@ export class NeusClient {
|
|
|
852
875
|
verificationData = {
|
|
853
876
|
agentId: data.agentId,
|
|
854
877
|
agentWallet: data?.agentWallet || walletAddress,
|
|
878
|
+
...(data?.agentChainRef && { agentChainRef: data.agentChainRef }),
|
|
879
|
+
...(data?.agentAccountId && { agentAccountId: data.agentAccountId }),
|
|
855
880
|
...(data?.agentLabel && { agentLabel: data.agentLabel }),
|
|
856
881
|
...(data?.agentType && { agentType: data.agentType }),
|
|
882
|
+
...(data?.avatar && { avatar: data.avatar }),
|
|
857
883
|
...(data?.description && { description: data.description }),
|
|
884
|
+
...(data?.defaultRuntime && { defaultRuntime: data.defaultRuntime }),
|
|
858
885
|
...(data?.capabilities && { capabilities: data.capabilities }),
|
|
859
886
|
...(data?.instructions && { instructions: data.instructions }),
|
|
860
887
|
...(data?.skills && { skills: data.skills }),
|
|
@@ -866,7 +893,11 @@ export class NeusClient {
|
|
|
866
893
|
}
|
|
867
894
|
verificationData = {
|
|
868
895
|
controllerWallet: data?.controllerWallet || walletAddress,
|
|
896
|
+
...(data?.controllerChainRef && { controllerChainRef: data.controllerChainRef }),
|
|
869
897
|
agentWallet: data.agentWallet,
|
|
898
|
+
...(data?.agentChainRef && { agentChainRef: data.agentChainRef }),
|
|
899
|
+
...(data?.controllerAccountId && { controllerAccountId: data.controllerAccountId }),
|
|
900
|
+
...(data?.agentAccountId && { agentAccountId: data.agentAccountId }),
|
|
870
901
|
...(data?.agentId && { agentId: data.agentId }),
|
|
871
902
|
...(data?.scope && { scope: data.scope }),
|
|
872
903
|
...(data?.permissions && { permissions: data.permissions }),
|
|
@@ -875,7 +906,13 @@ export class NeusClient {
|
|
|
875
906
|
...(data?.receiptDisclosure && { receiptDisclosure: data.receiptDisclosure }),
|
|
876
907
|
...(data?.expiresAt && { expiresAt: data.expiresAt }),
|
|
877
908
|
...(data?.instructions && { instructions: data.instructions }),
|
|
878
|
-
...(data?.skills && { skills: data.skills })
|
|
909
|
+
...(data?.skills && { skills: data.skills }),
|
|
910
|
+
...(data?.model && { model: data.model }),
|
|
911
|
+
...(data?.provider && { provider: data.provider }),
|
|
912
|
+
...(data?.runtimePolicy && { runtimePolicy: data.runtimePolicy }),
|
|
913
|
+
...(data?.allowedActions && { allowedActions: data.allowedActions }),
|
|
914
|
+
...(data?.deniedActions && { deniedActions: data.deniedActions }),
|
|
915
|
+
...(data?.approvalPolicy && { approvalPolicy: data.approvalPolicy })
|
|
879
916
|
};
|
|
880
917
|
} else if (verifier === 'ai-content-moderation') {
|
|
881
918
|
if (!data?.content) {
|
|
@@ -1120,11 +1157,10 @@ export class NeusClient {
|
|
|
1120
1157
|
}
|
|
1121
1158
|
|
|
1122
1159
|
async getProof(qHash) {
|
|
1123
|
-
|
|
1124
|
-
if (!resolvedQHash || typeof resolvedQHash !== 'string') {
|
|
1160
|
+
if (!qHash || typeof qHash !== 'string') {
|
|
1125
1161
|
throw new ValidationError('qHash is required');
|
|
1126
1162
|
}
|
|
1127
|
-
const response = await this._makeRequest('GET', `/api/v1/proofs/${
|
|
1163
|
+
const response = await this._makeRequest('GET', `/api/v1/proofs/${qHash}`);
|
|
1128
1164
|
|
|
1129
1165
|
if (!response.success) {
|
|
1130
1166
|
throw new ApiError(`Failed to get proof: ${response.error?.message || 'Unknown error'}`, response.error);
|
|
@@ -1134,8 +1170,7 @@ export class NeusClient {
|
|
|
1134
1170
|
}
|
|
1135
1171
|
|
|
1136
1172
|
async getPrivateProof(qHash, wallet = null) {
|
|
1137
|
-
|
|
1138
|
-
if (!resolvedQHash || typeof resolvedQHash !== 'string') {
|
|
1173
|
+
if (!qHash || typeof qHash !== 'string') {
|
|
1139
1174
|
throw new ValidationError('qHash is required');
|
|
1140
1175
|
}
|
|
1141
1176
|
|
|
@@ -1153,7 +1188,7 @@ export class NeusClient {
|
|
|
1153
1188
|
...(typeof auth.chain === 'string' && auth.chain.trim() ? { 'x-chain': auth.chain.trim() } : {}),
|
|
1154
1189
|
...(typeof auth.signatureMethod === 'string' && auth.signatureMethod.trim() ? { 'x-signature-method': auth.signatureMethod.trim() } : {})
|
|
1155
1190
|
};
|
|
1156
|
-
const response = await this._makeRequest('GET', `/api/v1/proofs/${
|
|
1191
|
+
const response = await this._makeRequest('GET', `/api/v1/proofs/${qHash}`, null, headers);
|
|
1157
1192
|
if (!response.success) {
|
|
1158
1193
|
throw new ApiError(
|
|
1159
1194
|
`Failed to access private proof: ${response.error?.message || 'Unauthorized'}`,
|
|
@@ -1177,7 +1212,7 @@ export class NeusClient {
|
|
|
1177
1212
|
const message = constructVerificationMessage({
|
|
1178
1213
|
walletAddress,
|
|
1179
1214
|
signedTimestamp,
|
|
1180
|
-
data: { action: 'access_private_proof', qHash:
|
|
1215
|
+
data: { action: 'access_private_proof', qHash: qHash },
|
|
1181
1216
|
verifierIds: ['ownership-basic'],
|
|
1182
1217
|
...(signerIsEvm ? { chainId: this._getHubChainId() } : { chain })
|
|
1183
1218
|
});
|
|
@@ -1197,7 +1232,7 @@ export class NeusClient {
|
|
|
1197
1232
|
throw new ValidationError(`Failed to sign message: ${error.message}`);
|
|
1198
1233
|
}
|
|
1199
1234
|
|
|
1200
|
-
const response = await this._makeRequest('GET', `/api/v1/proofs/${
|
|
1235
|
+
const response = await this._makeRequest('GET', `/api/v1/proofs/${qHash}`, null, {
|
|
1201
1236
|
'x-wallet-address': walletAddress,
|
|
1202
1237
|
'x-signature': signature,
|
|
1203
1238
|
'x-signed-timestamp': signedTimestamp.toString(),
|
|
@@ -1247,14 +1282,13 @@ export class NeusClient {
|
|
|
1247
1282
|
}
|
|
1248
1283
|
|
|
1249
1284
|
async pollProofStatus(qHash, options = {}) {
|
|
1250
|
-
const resolvedQHash = qHash; // Legacy input compatibility only. Do not expose or store proofId.
|
|
1251
1285
|
const {
|
|
1252
1286
|
interval = 5000,
|
|
1253
1287
|
timeout = 120000,
|
|
1254
1288
|
onProgress
|
|
1255
1289
|
} = options;
|
|
1256
1290
|
|
|
1257
|
-
if (!
|
|
1291
|
+
if (!qHash || typeof qHash !== 'string') {
|
|
1258
1292
|
throw new ValidationError('qHash is required');
|
|
1259
1293
|
}
|
|
1260
1294
|
|
|
@@ -1263,7 +1297,7 @@ export class NeusClient {
|
|
|
1263
1297
|
|
|
1264
1298
|
while (Date.now() - startTime < timeout) {
|
|
1265
1299
|
try {
|
|
1266
|
-
const status = await this.getProof(
|
|
1300
|
+
const status = await this.getProof(qHash);
|
|
1267
1301
|
consecutiveRateLimits = 0;
|
|
1268
1302
|
|
|
1269
1303
|
if (onProgress && typeof onProgress === 'function') {
|
|
@@ -1316,8 +1350,7 @@ export class NeusClient {
|
|
|
1316
1350
|
}
|
|
1317
1351
|
|
|
1318
1352
|
async revokeOwnProof(qHash, wallet) {
|
|
1319
|
-
|
|
1320
|
-
if (!resolvedQHash || typeof resolvedQHash !== 'string') {
|
|
1353
|
+
if (!qHash || typeof qHash !== 'string') {
|
|
1321
1354
|
throw new ValidationError('qHash is required');
|
|
1322
1355
|
}
|
|
1323
1356
|
const providerWallet = wallet || this._getDefaultBrowserWallet();
|
|
@@ -1333,7 +1366,7 @@ export class NeusClient {
|
|
|
1333
1366
|
const message = constructVerificationMessage({
|
|
1334
1367
|
walletAddress: address,
|
|
1335
1368
|
signedTimestamp,
|
|
1336
|
-
data: { action: 'revoke_proof', qHash:
|
|
1369
|
+
data: { action: 'revoke_proof', qHash: qHash },
|
|
1337
1370
|
verifierIds: ['ownership-basic'],
|
|
1338
1371
|
...(signerIsEvm ? { chainId: this._getHubChainId() } : { chain })
|
|
1339
1372
|
});
|
|
@@ -1353,7 +1386,7 @@ export class NeusClient {
|
|
|
1353
1386
|
throw new ValidationError(`Failed to sign revocation: ${error.message}`);
|
|
1354
1387
|
}
|
|
1355
1388
|
|
|
1356
|
-
const res = await this._makeRequest('POST', `/api/v1/proofs/revoke-self/${
|
|
1389
|
+
const res = await this._makeRequest('POST', `/api/v1/proofs/revoke-self/${qHash}`, {
|
|
1357
1390
|
walletAddress: address,
|
|
1358
1391
|
signature,
|
|
1359
1392
|
signedTimestamp,
|
|
@@ -1848,9 +1881,6 @@ export class NeusClient {
|
|
|
1848
1881
|
const qHash = response?.data?.qHash ||
|
|
1849
1882
|
response?.qHash ||
|
|
1850
1883
|
response?.data?.resource?.qHash ||
|
|
1851
|
-
response?.data?.proofId || // Legacy input compatibility only. Do not expose or store proofId.
|
|
1852
|
-
response?.proofId || // Legacy input compatibility only. Do not expose or store proofId.
|
|
1853
|
-
response?.data?.resource?.proofId || // Legacy input compatibility only. Do not expose or store proofId.
|
|
1854
1884
|
response?.data?.id;
|
|
1855
1885
|
|
|
1856
1886
|
const status = response?.data?.status ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neus/sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
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
5
|
"bin": {
|
|
6
6
|
"neus": "cli/neus.mjs"
|
|
@@ -67,7 +67,10 @@
|
|
|
67
67
|
"universal-protocol",
|
|
68
68
|
"proof",
|
|
69
69
|
"ownership",
|
|
70
|
-
"sdk"
|
|
70
|
+
"sdk",
|
|
71
|
+
"mcp",
|
|
72
|
+
"model-context-protocol",
|
|
73
|
+
"oauth"
|
|
71
74
|
],
|
|
72
75
|
"author": "NEUS Network",
|
|
73
76
|
"license": "Apache-2.0",
|
|
@@ -80,6 +83,10 @@
|
|
|
80
83
|
"url": "https://github.com/neus/network/issues"
|
|
81
84
|
},
|
|
82
85
|
"homepage": "https://neus.network",
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public",
|
|
88
|
+
"registry": "https://registry.npmjs.org"
|
|
89
|
+
},
|
|
83
90
|
"engines": {
|
|
84
91
|
"node": ">=20.0.0"
|
|
85
92
|
},
|
|
@@ -124,6 +131,7 @@
|
|
|
124
131
|
"widgets.cjs",
|
|
125
132
|
"types.d.ts",
|
|
126
133
|
"README.md",
|
|
134
|
+
"CHANGELOG.md",
|
|
127
135
|
"SECURITY.md",
|
|
128
136
|
"LICENSE",
|
|
129
137
|
"neus-logo.svg",
|
package/types.d.ts
CHANGED
|
@@ -81,8 +81,12 @@ declare module '@neus/sdk' {
|
|
|
81
81
|
export interface VerifierCatalogMetadataEntry {
|
|
82
82
|
category?: string;
|
|
83
83
|
description?: string;
|
|
84
|
+
accessLevel?: 'public' | 'pro' | 'custom' | 'admin' | string;
|
|
84
85
|
flowType?: 'instant' | 'interactive' | 'external_lookup' | string;
|
|
85
86
|
expiryType?: 'permanent' | 'point_in_time' | 'expiring' | string;
|
|
87
|
+
allowsDelegatedSubject?: boolean;
|
|
88
|
+
compatibleWith?: string[];
|
|
89
|
+
conflictsWith?: string[];
|
|
86
90
|
supportsDirectApi?: boolean;
|
|
87
91
|
supportsHostedVerify?: boolean;
|
|
88
92
|
dataSchema?: Record<string, any>;
|
|
@@ -599,6 +603,8 @@ declare module '@neus/sdk' {
|
|
|
599
603
|
| 'doc'
|
|
600
604
|
| 'media'
|
|
601
605
|
| 'username-claim'
|
|
606
|
+
| 'job'
|
|
607
|
+
| 'job-status'
|
|
602
608
|
| 'other';
|
|
603
609
|
id?: string;
|
|
604
610
|
title?: string;
|
|
@@ -646,7 +652,8 @@ declare module '@neus/sdk' {
|
|
|
646
652
|
contractAddress: string;
|
|
647
653
|
tokenId: string;
|
|
648
654
|
tokenType?: 'erc721' | 'erc1155';
|
|
649
|
-
chainId
|
|
655
|
+
chainId?: number;
|
|
656
|
+
chain?: string;
|
|
650
657
|
blockNumber?: number;
|
|
651
658
|
[key: string]: any;
|
|
652
659
|
};
|
|
@@ -655,24 +662,29 @@ declare module '@neus/sdk' {
|
|
|
655
662
|
ownerAddress?: string;
|
|
656
663
|
contractAddress: string;
|
|
657
664
|
minBalance: string;
|
|
658
|
-
chainId
|
|
665
|
+
chainId?: number;
|
|
666
|
+
chain?: string;
|
|
659
667
|
blockNumber?: number;
|
|
660
668
|
[key: string]: any;
|
|
661
669
|
};
|
|
662
670
|
|
|
663
671
|
type WalletRiskData = {
|
|
672
|
+
walletAddress: string;
|
|
664
673
|
provider?: string;
|
|
665
|
-
walletAddress?: string;
|
|
666
674
|
chainId?: number;
|
|
667
|
-
|
|
675
|
+
chain?: string;
|
|
668
676
|
[key: string]: any;
|
|
669
677
|
};
|
|
670
678
|
|
|
671
679
|
type WalletLinkData = {
|
|
672
|
-
primaryWalletAddress
|
|
673
|
-
secondaryWalletAddress
|
|
680
|
+
primaryWalletAddress?: string;
|
|
681
|
+
secondaryWalletAddress?: string;
|
|
682
|
+
primaryAccountId?: string;
|
|
683
|
+
secondaryAccountId?: string;
|
|
684
|
+
primaryChainRef?: string;
|
|
685
|
+
secondaryChainRef?: string;
|
|
674
686
|
signature: string;
|
|
675
|
-
chain
|
|
687
|
+
chain?: string;
|
|
676
688
|
signatureMethod: string;
|
|
677
689
|
signedTimestamp: number;
|
|
678
690
|
relationshipType?: 'primary' | 'personal' | 'org' | 'affiliate' | 'agent' | 'linked';
|
|
@@ -696,36 +708,70 @@ declare module '@neus/sdk' {
|
|
|
696
708
|
[key: string]: any;
|
|
697
709
|
};
|
|
698
710
|
|
|
711
|
+
type AgentSkillRef = {
|
|
712
|
+
id: string;
|
|
713
|
+
label?: string;
|
|
714
|
+
version?: string;
|
|
715
|
+
provider?: string;
|
|
716
|
+
kind?: 'native' | 'integration' | 'plugin' | 'mcp' | 'toolkit';
|
|
717
|
+
configId?: string;
|
|
718
|
+
enabled?: boolean;
|
|
719
|
+
};
|
|
720
|
+
|
|
699
721
|
type AgentIdentityData = {
|
|
700
722
|
agentId: string;
|
|
701
723
|
agentWallet: string;
|
|
724
|
+
agentChainRef: string;
|
|
725
|
+
agentAccountId?: string;
|
|
702
726
|
agentLabel?: string;
|
|
703
727
|
agentType?: 'ai' | 'bot' | 'service' | 'automation' | 'agent';
|
|
728
|
+
avatar?: string;
|
|
704
729
|
description?: string;
|
|
705
|
-
|
|
730
|
+
defaultRuntime?: {
|
|
731
|
+
provider?: string;
|
|
732
|
+
model?: string;
|
|
733
|
+
mode?: string;
|
|
734
|
+
};
|
|
735
|
+
capabilities?: Record<string, boolean>;
|
|
706
736
|
instructions?: string;
|
|
707
|
-
skills?:
|
|
737
|
+
skills?: AgentSkillRef[];
|
|
708
738
|
services?: Array<{
|
|
709
739
|
name: string;
|
|
710
740
|
endpoint: string;
|
|
711
741
|
version?: string;
|
|
712
742
|
}>;
|
|
713
|
-
[key: string]: any;
|
|
714
743
|
};
|
|
715
744
|
|
|
716
745
|
type AgentDelegationData = {
|
|
717
746
|
controllerWallet: string;
|
|
747
|
+
controllerChainRef: string;
|
|
718
748
|
agentWallet: string;
|
|
749
|
+
agentChainRef: string;
|
|
750
|
+
controllerAccountId?: string;
|
|
751
|
+
agentAccountId?: string;
|
|
719
752
|
agentId?: string;
|
|
720
753
|
scope?: string;
|
|
721
|
-
permissions?:
|
|
754
|
+
permissions?: string[];
|
|
722
755
|
maxSpend?: string;
|
|
723
756
|
allowedPaymentTypes?: string[];
|
|
724
757
|
receiptDisclosure?: 'none' | 'summary' | 'full';
|
|
725
758
|
expiresAt?: number;
|
|
726
759
|
instructions?: string;
|
|
727
|
-
skills?:
|
|
728
|
-
|
|
760
|
+
skills?: AgentSkillRef[];
|
|
761
|
+
model?: string;
|
|
762
|
+
provider?: string;
|
|
763
|
+
runtimePolicy?: {
|
|
764
|
+
allowedProviders?: string[];
|
|
765
|
+
allowedModelClasses?: string[];
|
|
766
|
+
requiresHumanApproval?: boolean;
|
|
767
|
+
secretsExposedToReceipt?: boolean;
|
|
768
|
+
};
|
|
769
|
+
allowedActions?: string[];
|
|
770
|
+
deniedActions?: string[];
|
|
771
|
+
approvalPolicy?: {
|
|
772
|
+
humanApprovalRequiredForNewClaims?: boolean;
|
|
773
|
+
preApprovedContentOnly?: boolean;
|
|
774
|
+
};
|
|
729
775
|
};
|
|
730
776
|
|
|
731
777
|
type CoreVerificationData =
|
|
@@ -785,6 +831,8 @@ declare module '@neus/sdk' {
|
|
|
785
831
|
| 'doc'
|
|
786
832
|
| 'media'
|
|
787
833
|
| 'username-claim'
|
|
834
|
+
| 'job'
|
|
835
|
+
| 'job-status'
|
|
788
836
|
| 'other';
|
|
789
837
|
id?: string;
|
|
790
838
|
title?: string;
|
|
@@ -28,7 +28,7 @@ var NeusLogo = ({ size = 12, logoUrl }) => /* @__PURE__ */ jsx(
|
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
function ProofBadge({
|
|
31
|
-
qHash
|
|
31
|
+
qHash,
|
|
32
32
|
proofUrlPattern = "/proof/:qHash",
|
|
33
33
|
size = "sm",
|
|
34
34
|
uiLinkBase = "https://neus.network",
|
|
@@ -38,10 +38,8 @@ function ProofBadge({
|
|
|
38
38
|
showLabel = true,
|
|
39
39
|
logoUrl = void 0,
|
|
40
40
|
onClick = void 0,
|
|
41
|
-
className = ""
|
|
42
|
-
...legacyProps
|
|
41
|
+
className = ""
|
|
43
42
|
}) {
|
|
44
|
-
const qHash = qHashProp ?? legacyProps.proofId;
|
|
45
43
|
const resolvedQHash = qHash;
|
|
46
44
|
const [status, setStatus] = useState(() => {
|
|
47
45
|
if (proof) {
|
|
@@ -149,7 +147,7 @@ function ProofBadge({
|
|
|
149
147
|
);
|
|
150
148
|
}
|
|
151
149
|
function SimpleProofBadge({
|
|
152
|
-
qHash
|
|
150
|
+
qHash,
|
|
153
151
|
proofUrlPattern = "/proof/:qHash",
|
|
154
152
|
uiLinkBase = "https://neus.network",
|
|
155
153
|
apiUrl = DEFAULT_API_BASE,
|
|
@@ -158,10 +156,8 @@ function SimpleProofBadge({
|
|
|
158
156
|
logoUrl = void 0,
|
|
159
157
|
proof = void 0,
|
|
160
158
|
onClick = void 0,
|
|
161
|
-
className = ""
|
|
162
|
-
...legacyProps
|
|
159
|
+
className = ""
|
|
163
160
|
}) {
|
|
164
|
-
const qHash = qHashProp ?? legacyProps.proofId;
|
|
165
161
|
const resolvedQHash = qHash;
|
|
166
162
|
const [status, setStatus] = useState(() => {
|
|
167
163
|
if (proof) {
|
|
@@ -244,17 +240,15 @@ function SimpleProofBadge({
|
|
|
244
240
|
);
|
|
245
241
|
}
|
|
246
242
|
function NeusPillLink({
|
|
247
|
-
qHash
|
|
243
|
+
qHash,
|
|
248
244
|
proofUrlPattern = "/proof/:qHash",
|
|
249
245
|
uiLinkBase = "https://neus.network",
|
|
250
246
|
label = "View",
|
|
251
247
|
size = "sm",
|
|
252
248
|
logoUrl = void 0,
|
|
253
249
|
onClick = void 0,
|
|
254
|
-
className = ""
|
|
255
|
-
...legacyProps
|
|
250
|
+
className = ""
|
|
256
251
|
}) {
|
|
257
|
-
const qHash = qHashProp ?? legacyProps.proofId;
|
|
258
252
|
const resolvedQHash = qHash;
|
|
259
253
|
const base = String(uiLinkBase).replace(/\/$/, "");
|
|
260
254
|
const href = resolvedQHash ? `${base}${String(proofUrlPattern).replace(":qHash", resolvedQHash)}` : base;
|
|
@@ -304,17 +298,15 @@ function NeusPillLink({
|
|
|
304
298
|
);
|
|
305
299
|
}
|
|
306
300
|
function VerifiedIcon({
|
|
307
|
-
qHash
|
|
301
|
+
qHash,
|
|
308
302
|
proofUrlPattern = "/proof/:qHash",
|
|
309
303
|
uiLinkBase = "https://neus.network",
|
|
310
304
|
size = 14,
|
|
311
305
|
logoUrl = void 0,
|
|
312
306
|
tooltip = "Proof",
|
|
313
307
|
onClick = void 0,
|
|
314
|
-
className = ""
|
|
315
|
-
...legacyProps
|
|
308
|
+
className = ""
|
|
316
309
|
}) {
|
|
317
|
-
const qHash = qHashProp ?? legacyProps.proofId;
|
|
318
310
|
const resolvedQHash = qHash;
|
|
319
311
|
const href = resolvedQHash ? `${String(uiLinkBase).replace(/\/$/, "")}${String(proofUrlPattern).replace(":qHash", resolvedQHash)}` : void 0;
|
|
320
312
|
const handleClick = (e) => {
|
|
@@ -124,11 +124,10 @@ function getVerifyGateUserError(err) {
|
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
function dispatchNeusProofCreatedForHost({ qHash, walletAddress
|
|
127
|
+
function dispatchNeusProofCreatedForHost({ qHash, walletAddress }) {
|
|
128
128
|
try {
|
|
129
129
|
if (typeof window === "undefined") return;
|
|
130
|
-
const raw = typeof qHash === "string"
|
|
131
|
-
"";
|
|
130
|
+
const raw = typeof qHash === "string" ? qHash.trim() : "";
|
|
132
131
|
if (!raw) return;
|
|
133
132
|
const w = typeof walletAddress === "string" ? walletAddress.trim() : "";
|
|
134
133
|
const normalizedWallet = w && /^0x[a-fA-F0-9]{40}$/.test(w) ? w.toLowerCase() : w;
|
|
@@ -211,8 +210,7 @@ function VerifyGate({
|
|
|
211
210
|
onError = void 0,
|
|
212
211
|
wallet = void 0,
|
|
213
212
|
chain = void 0,
|
|
214
|
-
signatureMethod = void 0
|
|
215
|
-
...legacyProps
|
|
213
|
+
signatureMethod = void 0
|
|
216
214
|
}) {
|
|
217
215
|
const [state, setState] = useState("idle");
|
|
218
216
|
const [error, setError] = useState(null);
|
|
@@ -229,7 +227,7 @@ function VerifyGate({
|
|
|
229
227
|
return Array.isArray(requiredVerifiers) && requiredVerifiers.length > 0 ? requiredVerifiers : ["ownership-basic"];
|
|
230
228
|
}, [requiredVerifiers]);
|
|
231
229
|
const primaryVerifier = verifierList[0];
|
|
232
|
-
const qHash = qHashProp ||
|
|
230
|
+
const qHash = qHashProp || null;
|
|
233
231
|
const resolvedQHash = qHash;
|
|
234
232
|
const hasInteractiveVerifier = useMemo(
|
|
235
233
|
() => verifierList.some((verifierId) => {
|
|
@@ -277,7 +275,7 @@ function VerifyGate({
|
|
|
277
275
|
setExistingProofs(gateResult);
|
|
278
276
|
const existingProof = gateResult.existing?.[primaryVerifier];
|
|
279
277
|
if (existingProof && onVerified) {
|
|
280
|
-
const existingQHash = existingProof.qHash ||
|
|
278
|
+
const existingQHash = existingProof.qHash || null;
|
|
281
279
|
onVerified({
|
|
282
280
|
qHash: existingQHash,
|
|
283
281
|
address: existingProof.walletAddress || address,
|
|
@@ -546,7 +544,7 @@ function VerifyGate({
|
|
|
546
544
|
setState("interactive-checkout");
|
|
547
545
|
onStateChange?.("interactive-checkout");
|
|
548
546
|
const checkoutResult = await launchHostedCheckout();
|
|
549
|
-
const checkoutQHash = checkoutResult?.qHash ||
|
|
547
|
+
const checkoutQHash = checkoutResult?.qHash || null;
|
|
550
548
|
const handoffWallet = typeof checkoutResult?.walletAddress === "string" && checkoutResult.walletAddress.trim() || walletAddress && String(walletAddress).trim() || "";
|
|
551
549
|
setState("verified");
|
|
552
550
|
dispatchNeusProofCreatedForHost({
|
|
@@ -611,7 +609,7 @@ function VerifyGate({
|
|
|
611
609
|
wallet: wallet || (typeof window !== "undefined" ? window.ethereum : void 0)
|
|
612
610
|
});
|
|
613
611
|
setState("verifying");
|
|
614
|
-
const qHashToCheck = created.qHash || created
|
|
612
|
+
const qHashToCheck = created.qHash || created?.data?.qHash;
|
|
615
613
|
const final = await client.pollProofStatus(qHashToCheck, { interval: 3e3, timeout: 6e4 });
|
|
616
614
|
const verifiedVerifiers = final?.data?.verifiedVerifiers || [];
|
|
617
615
|
const verifierResult = verifiedVerifiers.find((v) => v.verifierId === verifierId);
|
|
@@ -621,7 +619,7 @@ function VerifyGate({
|
|
|
621
619
|
const hubTx = final?.data?.hubTransaction || {};
|
|
622
620
|
const crosschain = final?.data?.crosschain || {};
|
|
623
621
|
const txHash = hubTx?.txHash || crosschain?.hubTxHash || null;
|
|
624
|
-
const finalQHash = final?.qHash ||
|
|
622
|
+
const finalQHash = final?.qHash || qHashToCheck;
|
|
625
623
|
return {
|
|
626
624
|
verifierId,
|
|
627
625
|
qHash: finalQHash,
|