@neus/sdk 1.0.8 → 1.0.10

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/client.js CHANGED
@@ -924,22 +924,12 @@ export class NeusClient {
924
924
  for (let i = 0; i < full.length; i++) payloadHex += full[i].toString(16).padStart(2, '0');
925
925
  try {
926
926
  if (typeof window !== 'undefined') window.__NEUS_ALLOW_ETH_SIGN__ = true;
927
- } catch {
928
- void 0;
929
- }
930
- signature = await provider.request({ method: 'eth_sign', params: [walletAddress, payloadHex], neusAllowEthSign: true });
931
- try {
932
- if (typeof window !== 'undefined') delete window.__NEUS_ALLOW_ETH_SIGN__;
933
- } catch {
934
- void 0;
927
+ signature = await provider.request({ method: 'eth_sign', params: [walletAddress, payloadHex], neusAllowEthSign: true });
928
+ } finally {
929
+ try { if (typeof window !== 'undefined') delete window.__NEUS_ALLOW_ETH_SIGN__; } catch { void 0; }
935
930
  }
936
931
  } catch (fallbackErr) {
937
932
  this._log('eth_sign fallback failed', { message: fallbackErr?.message || String(fallbackErr) });
938
- try {
939
- if (typeof window !== 'undefined') delete window.__NEUS_ALLOW_ETH_SIGN__;
940
- } catch {
941
- void 0;
942
- }
943
933
  throw e;
944
934
  }
945
935
  } else if (needsHex) {
@@ -1046,11 +1036,12 @@ export class NeusClient {
1046
1036
  return this._formatResponse(response);
1047
1037
  }
1048
1038
 
1049
- async getProof(proofId) {
1050
- if (!proofId || typeof proofId !== 'string') {
1051
- throw new ValidationError('proofId is required');
1039
+ async getProof(qHash) {
1040
+ const resolvedQHash = qHash; // Legacy input compatibility only. Do not expose or store proofId.
1041
+ if (!resolvedQHash || typeof resolvedQHash !== 'string') {
1042
+ throw new ValidationError('qHash is required');
1052
1043
  }
1053
- const response = await this._makeRequest('GET', `/api/v1/proofs/${proofId}`);
1044
+ const response = await this._makeRequest('GET', `/api/v1/proofs/${resolvedQHash}`);
1054
1045
 
1055
1046
  if (!response.success) {
1056
1047
  throw new ApiError(`Failed to get proof: ${response.error?.message || 'Unknown error'}`, response.error);
@@ -1059,9 +1050,10 @@ export class NeusClient {
1059
1050
  return this._formatResponse(response);
1060
1051
  }
1061
1052
 
1062
- async getPrivateProof(proofId, wallet = null) {
1063
- if (!proofId || typeof proofId !== 'string') {
1064
- throw new ValidationError('proofId is required');
1053
+ async getPrivateProof(qHash, wallet = null) {
1054
+ const resolvedQHash = qHash; // Legacy input compatibility only. Do not expose or store proofId.
1055
+ if (!resolvedQHash || typeof resolvedQHash !== 'string') {
1056
+ throw new ValidationError('qHash is required');
1065
1057
  }
1066
1058
 
1067
1059
  const isPreSignedAuth = wallet &&
@@ -1078,7 +1070,7 @@ export class NeusClient {
1078
1070
  ...(typeof auth.chain === 'string' && auth.chain.trim() ? { 'x-chain': auth.chain.trim() } : {}),
1079
1071
  ...(typeof auth.signatureMethod === 'string' && auth.signatureMethod.trim() ? { 'x-signature-method': auth.signatureMethod.trim() } : {})
1080
1072
  };
1081
- const response = await this._makeRequest('GET', `/api/v1/proofs/${proofId}`, null, headers);
1073
+ const response = await this._makeRequest('GET', `/api/v1/proofs/${resolvedQHash}`, null, headers);
1082
1074
  if (!response.success) {
1083
1075
  throw new ApiError(
1084
1076
  `Failed to access private proof: ${response.error?.message || 'Unauthorized'}`,
@@ -1102,7 +1094,7 @@ export class NeusClient {
1102
1094
  const message = constructVerificationMessage({
1103
1095
  walletAddress,
1104
1096
  signedTimestamp,
1105
- data: { action: 'access_private_proof', qHash: proofId },
1097
+ data: { action: 'access_private_proof', qHash: resolvedQHash },
1106
1098
  verifierIds: ['ownership-basic'],
1107
1099
  ...(signerIsEvm ? { chainId: this._getHubChainId() } : { chain })
1108
1100
  });
@@ -1122,7 +1114,7 @@ export class NeusClient {
1122
1114
  throw new ValidationError(`Failed to sign message: ${error.message}`);
1123
1115
  }
1124
1116
 
1125
- const response = await this._makeRequest('GET', `/api/v1/proofs/${proofId}`, null, {
1117
+ const response = await this._makeRequest('GET', `/api/v1/proofs/${resolvedQHash}`, null, {
1126
1118
  'x-wallet-address': walletAddress,
1127
1119
  'x-signature': signature,
1128
1120
  'x-signed-timestamp': signedTimestamp.toString(),
@@ -1171,15 +1163,16 @@ export class NeusClient {
1171
1163
  };
1172
1164
  }
1173
1165
 
1174
- async pollProofStatus(proofId, options = {}) {
1166
+ async pollProofStatus(qHash, options = {}) {
1167
+ const resolvedQHash = qHash; // Legacy input compatibility only. Do not expose or store proofId.
1175
1168
  const {
1176
1169
  interval = 5000,
1177
1170
  timeout = 120000,
1178
1171
  onProgress
1179
1172
  } = options;
1180
1173
 
1181
- if (!proofId || typeof proofId !== 'string') {
1182
- throw new ValidationError('proofId is required');
1174
+ if (!resolvedQHash || typeof resolvedQHash !== 'string') {
1175
+ throw new ValidationError('qHash is required');
1183
1176
  }
1184
1177
 
1185
1178
  const startTime = Date.now();
@@ -1187,7 +1180,7 @@ export class NeusClient {
1187
1180
 
1188
1181
  while (Date.now() - startTime < timeout) {
1189
1182
  try {
1190
- const status = await this.getProof(proofId);
1183
+ const status = await this.getProof(resolvedQHash);
1191
1184
  consecutiveRateLimits = 0;
1192
1185
 
1193
1186
  if (onProgress && typeof onProgress === 'function') {
@@ -1239,9 +1232,10 @@ export class NeusClient {
1239
1232
  }
1240
1233
  }
1241
1234
 
1242
- async revokeOwnProof(proofId, wallet) {
1243
- if (!proofId || typeof proofId !== 'string') {
1244
- throw new ValidationError('proofId is required');
1235
+ async revokeOwnProof(qHash, wallet) {
1236
+ const resolvedQHash = qHash; // Legacy input compatibility only. Do not expose or store proofId.
1237
+ if (!resolvedQHash || typeof resolvedQHash !== 'string') {
1238
+ throw new ValidationError('qHash is required');
1245
1239
  }
1246
1240
  const providerWallet = wallet || this._getDefaultBrowserWallet();
1247
1241
  const { signerWalletAddress: address, provider } = await this._resolveWalletSigner(providerWallet);
@@ -1256,7 +1250,7 @@ export class NeusClient {
1256
1250
  const message = constructVerificationMessage({
1257
1251
  walletAddress: address,
1258
1252
  signedTimestamp,
1259
- data: { action: 'revoke_proof', qHash: proofId },
1253
+ data: { action: 'revoke_proof', qHash: resolvedQHash },
1260
1254
  verifierIds: ['ownership-basic'],
1261
1255
  ...(signerIsEvm ? { chainId: this._getHubChainId() } : { chain })
1262
1256
  });
@@ -1276,15 +1270,11 @@ export class NeusClient {
1276
1270
  throw new ValidationError(`Failed to sign revocation: ${error.message}`);
1277
1271
  }
1278
1272
 
1279
- const res = await fetch(`${this.config.apiUrl}/api/v1/proofs/revoke-self/${proofId}`, {
1280
- method: 'POST',
1281
- headers: { 'Content-Type': 'application/json' },
1282
- body: JSON.stringify({
1283
- walletAddress: address,
1284
- signature,
1285
- signedTimestamp,
1286
- ...(signerIsEvm ? {} : { chain, signatureMethod })
1287
- })
1273
+ const res = await this._makeRequest('POST', `/api/v1/proofs/revoke-self/${resolvedQHash}`, {
1274
+ walletAddress: address,
1275
+ signature,
1276
+ signedTimestamp,
1277
+ ...(signerIsEvm ? {} : { chain, signatureMethod })
1288
1278
  });
1289
1279
  const json = await res.json();
1290
1280
  if (!json.success) {
@@ -1476,6 +1466,7 @@ export class NeusClient {
1476
1466
  setIfPresent('primaryWalletAddress', params.primaryWalletAddress);
1477
1467
  setIfPresent('secondaryWalletAddress', params.secondaryWalletAddress);
1478
1468
  setIfPresent('verificationMethod', params.verificationMethod);
1469
+ setIfPresent('neusPersonhoodId', params.neusPersonhoodId);
1479
1470
 
1480
1471
  let headersOverride = null;
1481
1472
  if (params.includePrivate === true) {
@@ -1771,20 +1762,13 @@ export class NeusClient {
1771
1762
  }
1772
1763
 
1773
1764
  _formatResponse(response) {
1774
- const proofId = response?.data?.proofId ||
1775
- response?.proofId ||
1776
- response?.data?.resource?.proofId ||
1777
- response?.data?.qHash ||
1778
- response?.qHash ||
1779
- response?.data?.resource?.qHash ||
1780
- response?.data?.id;
1781
1765
  const qHash = response?.data?.qHash ||
1782
1766
  response?.qHash ||
1783
1767
  response?.data?.resource?.qHash ||
1784
- proofId ||
1768
+ response?.data?.proofId || // Legacy input compatibility only. Do not expose or store proofId.
1769
+ response?.proofId || // Legacy input compatibility only. Do not expose or store proofId.
1770
+ response?.data?.resource?.proofId || // Legacy input compatibility only. Do not expose or store proofId.
1785
1771
  response?.data?.id;
1786
- const finalProofId = proofId || qHash || null;
1787
- const finalQHash = qHash || proofId || finalProofId;
1788
1772
 
1789
1773
  const status = response?.data?.status ||
1790
1774
  response?.status ||
@@ -1793,13 +1777,12 @@ export class NeusClient {
1793
1777
 
1794
1778
  return {
1795
1779
  success: response.success,
1796
- proofId: finalProofId,
1797
- qHash: finalQHash,
1780
+ qHash,
1798
1781
  status,
1799
1782
  data: response.data,
1800
1783
  message: response.message,
1801
1784
  timestamp: Date.now(),
1802
- proofUrl: finalProofId ? `${this.baseUrl}/api/v1/proofs/${finalProofId}` : null
1785
+ proofUrl: qHash ? `${this.baseUrl}/api/v1/proofs/${qHash}` : null
1803
1786
  };
1804
1787
  }
1805
1788
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neus/sdk",
3
- "version": "1.0.8",
4
- "description": "Portable trust receipts for people, apps, and agents. Verify once, check gates across surfaces.",
3
+ "version": "1.0.10",
4
+ "description": "Issue and check NEUS trust receipts across apps, agents, gates, payments, and workflows.",
5
5
  "bin": {
6
6
  "neus": "cli/neus.mjs"
7
7
  },
@@ -84,7 +84,6 @@
84
84
  "node": ">=20.0.0"
85
85
  },
86
86
  "peerDependencies": {
87
- "@zkpassport/sdk": "0.13.1",
88
87
  "ethers": "^6.0.0",
89
88
  "react": ">=17.0.0",
90
89
  "react-dom": ">=17.0.0"
@@ -101,7 +100,7 @@
101
100
  }
102
101
  },
103
102
  "optionalDependencies": {
104
- "@zkpassport/sdk": "0.13.1"
103
+ "@zkpassport/sdk": "^0.14.0"
105
104
  },
106
105
  "dependencies": {
107
106
  "bs58": "^6.0.0"
package/types.d.ts CHANGED
@@ -10,9 +10,9 @@ declare module '@neus/sdk' {
10
10
 
11
11
  verify(params: VerifyParams): Promise<VerificationResult>;
12
12
 
13
- getProof(proofId: string): Promise<StatusResult>;
14
-
15
- getPrivateProof(proofId: string, wallet?: WalletLike | GatePrivateAuth): Promise<StatusResult>;
13
+ getProof(qHash: string): Promise<StatusResult>;
14
+
15
+ getPrivateProof(qHash: string, wallet?: WalletLike | GatePrivateAuth): Promise<StatusResult>;
16
16
 
17
17
  isHealthy(): Promise<boolean>;
18
18
 
@@ -30,9 +30,9 @@ declare module '@neus/sdk' {
30
30
  label?: string;
31
31
  }): Promise<WalletLinkData>;
32
32
 
33
- pollProofStatus(proofId: string, options?: PollOptions): Promise<StatusResult>;
33
+ pollProofStatus(qHash: string, options?: PollOptions): Promise<StatusResult>;
34
34
 
35
- revokeOwnProof(proofId: string, wallet?: { address: string }): Promise<boolean>;
35
+ revokeOwnProof(qHash: string, wallet?: { address: string }): Promise<boolean>;
36
36
 
37
37
  getProofsByWallet(walletAddress: string, options?: GetProofsOptions): Promise<ProofsResult>;
38
38
 
@@ -109,16 +109,14 @@ declare module '@neus/sdk' {
109
109
  }
110
110
 
111
111
  export interface ProofResult {
112
- proofId: string;
113
112
  qHash: string;
114
113
  status: string;
115
114
  walletAddress?: string;
116
115
  proofUrl?: string;
117
116
  crossChain?: boolean;
118
117
  }
119
-
118
+
120
119
  export interface VerificationResult {
121
- proofId: string;
122
120
  qHash: string;
123
121
  status: VerificationStatus;
124
122
  success: boolean;
@@ -126,13 +124,11 @@ declare module '@neus/sdk' {
126
124
  }
127
125
 
128
126
  export interface StatusResult {
129
- proofId?: string;
130
127
  qHash?: string;
131
128
  proofUrl?: string | null;
132
129
  success: boolean;
133
130
  status: VerificationStatus;
134
131
  data?: {
135
- proofId?: string;
136
132
  qHash?: string;
137
133
  status: string;
138
134
  walletAddress: string;
@@ -341,7 +337,7 @@ declare module '@neus/sdk' {
341
337
  };
342
338
 
343
339
  export class StatusPoller {
344
- constructor(client: NeusClient, proofId: string, options?: { interval?: number; maxAttempts?: number; exponentialBackoff?: boolean; maxInterval?: number });
340
+ constructor(client: NeusClient, qHash: string, options?: { interval?: number; maxAttempts?: number; exponentialBackoff?: boolean; maxInterval?: number });
345
341
  poll(): Promise<StatusResult>;
346
342
  }
347
343
 
@@ -505,6 +501,8 @@ declare module '@neus/sdk' {
505
501
  primaryWalletAddress?: string;
506
502
  secondaryWalletAddress?: string;
507
503
  verificationMethod?: string;
504
+ /** Personhood ID for proof-of-human sybil resistance matching (0x-prefixed 64-hex-char SHA-256 digest) */
505
+ neusPersonhoodId?: string;
508
506
  }
509
507
 
510
508
  export interface GatePrivateAuth {
@@ -521,7 +519,6 @@ declare module '@neus/sdk' {
521
519
  eligible: boolean;
522
520
  matchedCount?: number;
523
521
  matchedQHashes?: string[];
524
- matchedProofIds?: string[];
525
522
  matchedTags?: string[];
526
523
  projections?: Array<Record<string, any>> | null;
527
524
  criteria?: Record<string, any>;
@@ -790,9 +787,7 @@ declare module '@neus/sdk/widgets' {
790
787
  export interface VerifyGateProps {
791
788
  requiredVerifiers?: string[];
792
789
  onVerified?: (result: {
793
- proofId: string;
794
790
  qHash: string;
795
- proofIds?: string[];
796
791
  qHashes?: string[];
797
792
  address?: string;
798
793
  txHash?: string | null;
@@ -805,7 +800,6 @@ declare module '@neus/sdk/widgets' {
805
800
  data?: any;
806
801
  results?: Array<{
807
802
  verifierId: string;
808
- proofId: string;
809
803
  qHash: string;
810
804
  address?: string;
811
805
  txHash?: string | null;
@@ -833,7 +827,6 @@ declare module '@neus/sdk/widgets' {
833
827
  disabled?: boolean;
834
828
  buttonText?: string;
835
829
  mode?: 'create' | 'access';
836
- proofId?: string | null;
837
830
  qHash?: string | null;
838
831
  wallet?: WalletLike | any;
839
832
  chain?: string;
@@ -845,7 +838,6 @@ declare module '@neus/sdk/widgets' {
845
838
  export function VerifyGate(props: VerifyGateProps): any;
846
839
 
847
840
  export interface ProofBadgeProps {
848
- proofId?: string;
849
841
  qHash?: string;
850
842
  proofUrlPattern?: string;
851
843
  size?: 'sm' | 'md';
@@ -855,14 +847,13 @@ declare module '@neus/sdk/widgets' {
855
847
  showChains?: boolean;
856
848
  showLabel?: boolean;
857
849
  logoUrl?: string;
858
- onClick?: (data: { proofId: string; qHash: string; status: string; chainCount?: number }) => void;
850
+ onClick?: (data: { qHash: string; status: string; chainCount?: number }) => void;
859
851
  className?: string;
860
852
  }
861
853
 
862
854
  export function ProofBadge(props: ProofBadgeProps): any;
863
855
 
864
856
  export interface SimpleProofBadgeProps {
865
- proofId?: string;
866
857
  qHash?: string;
867
858
  proofUrlPattern?: string;
868
859
  uiLinkBase?: string;
@@ -871,35 +862,33 @@ declare module '@neus/sdk/widgets' {
871
862
  label?: string;
872
863
  logoUrl?: string;
873
864
  proof?: any;
874
- onClick?: (data: { proofId: string; qHash: string; status: string }) => void;
865
+ onClick?: (data: { qHash: string; status: string }) => void;
875
866
  className?: string;
876
867
  }
877
868
 
878
869
  export function SimpleProofBadge(props: SimpleProofBadgeProps): any;
879
870
 
880
871
  export interface NeusPillLinkProps {
881
- proofId?: string;
882
872
  qHash?: string;
883
873
  proofUrlPattern?: string;
884
874
  uiLinkBase?: string;
885
875
  label?: string;
886
876
  size?: 'sm' | 'md';
887
877
  logoUrl?: string;
888
- onClick?: (data: { proofId?: string; qHash?: string }) => void;
878
+ onClick?: (data: { qHash?: string }) => void;
889
879
  className?: string;
890
880
  }
891
881
 
892
882
  export function NeusPillLink(props: NeusPillLinkProps): any;
893
883
 
894
884
  export interface VerifiedIconProps {
895
- proofId?: string;
896
885
  qHash?: string;
897
886
  proofUrlPattern?: string;
898
887
  uiLinkBase?: string;
899
888
  size?: number;
900
889
  logoUrl?: string;
901
890
  tooltip?: string;
902
- onClick?: (data: { proofId?: string; qHash?: string }) => void;
891
+ onClick?: (data: { qHash?: string }) => void;
903
892
  className?: string;
904
893
  }
905
894
 
package/widgets/README.md CHANGED
@@ -35,7 +35,7 @@ export function Page() {
35
35
  ```jsx
36
36
  import { ProofBadge } from '@neus/sdk/widgets';
37
37
 
38
- <ProofBadge proofId="0x..." showChains />
38
+ <ProofBadge qHash="0x..." showChains />
39
39
  ```
40
40
 
41
41
  ## Docs