@zkp2p/zkp2p-attestation 3.0.1 → 3.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.0
4
+
5
+ - Remove the retired preproduction hostname and PCR8 from bundled trust pins.
6
+ - Add typed Venmo and PayPal dispute helpers for attested session encryption, `POST /dispute/verify`, and local `DisputeAttestation` verification. The helpers use the `ZKP2P DisputeVerifier` EIP-712 domain and `DisputeDetails` wire fields while keeping all extracted identifiers out of public params.
7
+
3
8
  ## 3.0.1
4
9
 
5
10
  - Restore the generic Buyer TEE compact JWE for standalone identity capture while retaining the Alipay types added in 3.0.0. `callerAddress` remains required on `POST /identity` and in the signed typed data, but is no longer required by identity encryption helpers or nested inside encrypted session material.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @zkp2p/zkp2p-attestation
2
2
 
3
- Client-side verifier and encryptor for ZKP2P Nitro identity attestations, seller credential uploads, and buyer TEE session-material requests.
3
+ Client-side verifier and encryptor for ZKP2P Nitro payment, dispute, identity, and seller-credential flows.
4
4
 
5
5
  The package runs in Chrome MV3 service workers, browser DOM contexts, React Native with a Web Crypto polyfill, and Node >= 20. Library entrypoints use `fetch`, `SubtleCrypto`, `crypto.getRandomValues`, and `Uint8Array`; they do not import `node:*` modules or use `Buffer`.
6
6
 
@@ -33,7 +33,7 @@ Environment defaults:
33
33
  | `staging` | `https://attestation-service-staging.zkp2p.xyz` | bundled staging pin |
34
34
  | `production` | `https://attestation-service.zkp2p.xyz` | bundled production pin |
35
35
 
36
- Callers can still pass `attestationServiceUrl` and `trust.expectedPcr8Hex` directly. Explicit trust pins always win. The preprod hostname is pinned to the isolated preprod enclave; it is not a production alias.
36
+ Callers can still pass `attestationServiceUrl` and `trust.expectedPcr8Hex` directly. Explicit trust pins always win. Bundled trust is limited to the canonical staging and production hostnames.
37
37
 
38
38
  ## Fast Path
39
39
 
@@ -162,10 +162,37 @@ Per-platform session-material types require these headers using the canonical na
162
162
  additional captured headers. Captured request bodies are session material because they can contain sensitive data and
163
163
  are encrypted before being sent to the service.
164
164
 
165
- Identity requests use the same generic attested upload envelope as buyer TEE. The typed request helper encrypts the
166
- captured session material, normalizes the outer `callerAddress`, posts
167
- `{ platform, actionType, callerAddress, encryptedSessionMaterial, params }` to the public `POST /identity` endpoint,
168
- unwraps the service response, and returns an `IdentityAttestationOutput`. `verifyIdentityAttestation` checks the EIP-712 signature, trusted signer,
165
+ Dispute verification uses the same attested key and compact JWE shape. The complete raw email stays encrypted, and all
166
+ payment, dispute, and amount fields come from its authenticated contents rather than public params.
167
+
168
+ ```ts
169
+ const dispute = await nitro.verifyDispute({
170
+ platform: "venmo",
171
+ actionType: "dispute_venmo",
172
+ sessionMaterial: { rawEmail: completeRfc5322Email },
173
+ params: {},
174
+ chainId,
175
+ intentHash,
176
+ });
177
+
178
+ const verifiedDispute = verifyDisputeAttestation(dispute, {
179
+ trustedSigners,
180
+ expectedPlatform: "venmo",
181
+ expectedActionType: "dispute_venmo",
182
+ expectedDomain: { chainId, verifyingContract: disputeVerifier },
183
+ expectedIntentHash: intentHash,
184
+ });
185
+ ```
186
+
187
+ Venmo uses `dispute_venmo`; PayPal uses `dispute_paypal`. Both accept only `{ rawEmail }` encrypted session material
188
+ and `{}` public params. `verifyDisputeAttestation` checks the DisputeVerifier EIP-712 domain, the same trusted
189
+ attestation-service witnesses used by payment and identity, the request intent, the signed data hash, and exact parity
190
+ between `disputeDetails` and `encodedDisputeDetails`.
191
+
192
+ Identity requests use the same attested upload key and compact JWE plaintext shape as buyer TEE, but with a narrower
193
+ platform/action matrix. The typed helper encrypts captured session material, posts
194
+ `{ platform, actionType, callerAddress, encryptedSessionMaterial, params }` to `POST /identity`, unwraps the service response, and
195
+ returns an `IdentityAttestationOutput`. `verifyIdentityAttestation` checks the EIP-712 signature, trusted signer,
169
196
  platform/action binding, expected caller address, expected payee hash, canonical identity `dataHash`, and `validUntil`,
170
197
  then returns normalized identity details.
171
198
 
@@ -215,7 +242,9 @@ For Cash App identity, pass the replayable Cash App session cookie as `sessionMa
215
242
 
216
243
  For Alipay identity, pass a replayable `Cookie` header. The service fetches the authenticated account page and signs
217
244
  the historical transfer-recipient preimage: normalized recipient name concatenated directly with the redacted,
218
- lowercased email. The full normalized email is returned as `identity.username` for Curator binding.
245
+ lowercased email. CJK names use their final CJK character to match Alipay's masked transfer detail; non-CJK names keep
246
+ the existing token normalization. The normalized full email remains `identity.username`; the authenticated account's
247
+ 16-digit PID is returned as `identity.metadata.alipayPid` for payment routing.
219
248
 
220
249
  Buyer TEE and identity expose discriminated unions keyed by `platform` and `actionType`, including per-platform
221
250
  `params`, so invalid pairings fail during TypeScript compilation. Seller credential upload keeps its existing
@@ -268,6 +297,17 @@ Identity helpers emit `{ platform, actionType, sessionMaterial, boundPubKeySha25
268
297
  like buyer TEE capture. The outer `callerAddress` is required by `POST /identity` and included in the signed typed data,
269
298
  but is not encrypted into or authenticated by the session envelope.
270
299
 
300
+ For dispute flows with a cached attestation:
301
+
302
+ ```ts
303
+ const encryptedSessionMaterial = await nitro.encryptDisputeSessionMaterial({
304
+ key: verified.attestedSellerUploadKey,
305
+ platform: "paypal",
306
+ actionType: "dispute_paypal",
307
+ sessionMaterial: { rawEmail: completeRfc5322Email },
308
+ });
309
+ ```
310
+
271
311
  The attested SPKI is stable within one enclave process. If the enclave restarts, cached keys become stale and upload decrypt will fail; fetch a fresh attestation for a new session.
272
312
 
273
313
  ## React Native Wiring
@@ -290,18 +330,23 @@ Any conforming `SubtleCrypto` works. The package does not require `Buffer`.
290
330
  ```ts
291
331
  import {
292
332
  createEncryptedBuyerTeeSessionMaterial,
333
+ createEncryptedDisputeSessionMaterial,
293
334
  createEncryptedIdentitySessionMaterial,
294
335
  createEncryptedSellerCredentialUpload,
295
336
  encryptBuyerTeeSessionMaterial,
337
+ encryptDisputeSessionMaterial,
296
338
  encryptIdentitySessionMaterial,
297
339
  encryptSellerCredentialUpload,
298
340
  fetchAndVerifyAttestation,
299
341
  getUnifiedPaymentVerifierDomainSeparator,
342
+ getDisputeVerifierDomainSeparator,
300
343
  hashUtf8,
301
344
  requestIdentityAttestation,
302
345
  uploadSellerCredential,
303
346
  verifyBuyerTeePaymentAttestation,
304
347
  verifyBuyerTeePayment,
348
+ verifyDispute,
349
+ verifyDisputeAttestation,
305
350
  verifyIdentityAttestation,
306
351
  verifySellerCredentialBundle,
307
352
  } from "@zkp2p/zkp2p-attestation";
@@ -4510,10 +4510,8 @@ var DEFAULT_TIMEOUT_MS = 1e4;
4510
4510
  // src/trust/pins.ts
4511
4511
  var STAGING_PCR8 = "5636e3bd96f847cf12cfd9de7faa8cad0e6fa00962ce16ba185f8e5ea57105abb3cc9cc34f1e1e4de3444ceabcca7485";
4512
4512
  var PRODUCTION_PCR8 = "41a4ae0b9b96752cab5addb7d22689b3070e564e29f90a54316fa33fa38ea51387a6e887ea4f5a4b0cc34f69cea3f40e";
4513
- var PREPROD_PCR8 = "5453c5bfb7d040285be5ba9af142f4fbdd9685d082f244b66c62bf7b22d8d02a638fa2e02b9a6fe8877953a9429209e0";
4514
4513
  var DEFAULT_EXPECTED_PCR8_BY_HOST = {
4515
4514
  "attestation-service-staging.zkp2p.xyz": normalizePcr8Pin(STAGING_PCR8, "bundled staging PCR8"),
4516
- "attestation-service-preprod.zkp2p.xyz": normalizePcr8Pin(PREPROD_PCR8, "bundled preprod PCR8"),
4517
4515
  "attestation-service.zkp2p.xyz": normalizePcr8Pin(PRODUCTION_PCR8, "bundled production PCR8")
4518
4516
  };
4519
4517