@zkp2p/zkp2p-attestation 3.0.0 → 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,15 @@
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
+
8
+ ## 3.0.1
9
+
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.
11
+ - Keep PayPal, Wise, and Alipay maker registration public without Privy bearer authentication, linked-wallet enforcement, an alternate endpoint, or a compatibility wire.
12
+
3
13
  ## 3.0.0
4
14
 
5
15
  - BREAKING: `/identity` and its package helpers now require normalized `callerAddress` inside session-material JWEs and require the encrypted address to match the outer request. Unbound identity envelopes are rejected; buyer TEE envelopes are unchanged.
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,8 +162,35 @@ 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 attested upload key as buyer TEE, but use a caller-bound plaintext envelope. The typed
166
- helper normalizes `callerAddress`, encrypts it together with captured session material, posts
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
167
194
  `{ platform, actionType, callerAddress, encryptedSessionMaterial, params }` to `POST /identity`, unwraps the service response, and
168
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`,
@@ -201,7 +228,7 @@ Identity platform matrix:
201
228
  | `cashapp` | `register_cashapp` | `sessionCookie`, `requestPayload`, optional `requestHeaders` | `{}` |
202
229
  | `alipay` | `register_alipay` | `Cookie` | `{}` |
203
230
 
204
- This matrix is intentionally limited to the caller-bound `POST /identity` request flow. A Monobank seller credential
231
+ This matrix is intentionally limited to the public `POST /identity` request flow. A Monobank seller credential
205
232
  upload can additionally return a typed `IdentityAttestationOutputFor<"monobank">` with `register_monobank`; consumers
206
233
  can pass that response directly to `verifyIdentityAttestation`, but cannot request it through `POST /identity`.
207
234
 
@@ -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
@@ -258,17 +287,26 @@ const encryptedSessionMaterial = await nitro.encryptIdentitySessionMaterial({
258
287
  key: verified.attestedSellerUploadKey,
259
288
  platform: "paypal",
260
289
  actionType: "register_paypal",
261
- callerAddress: "0x0000000000000000000000000000000000000002",
262
290
  sessionMaterial: {
263
291
  Cookie: "<captured-cookie-header>",
264
292
  },
265
293
  });
266
294
  ```
267
295
 
268
- Identity helpers emit `{ platform, actionType, sessionMaterial: { callerAddress, sessionMaterial },
269
- boundPubKeySha256 }` inside the compact JWE. The service requires the encrypted, normalized address to exactly match
270
- the outer request address before any provider request or signature. Identity JWEs created without this binding are
271
- rejected and must be regenerated. Buyer TEE envelopes retain their existing wire shape.
296
+ Identity helpers emit `{ platform, actionType, sessionMaterial, boundPubKeySha256 }` inside the compact JWE, exactly
297
+ like buyer TEE capture. The outer `callerAddress` is required by `POST /identity` and included in the signed typed data,
298
+ but is not encrypted into or authenticated by the session envelope.
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
+ ```
272
310
 
273
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.
274
312
 
@@ -292,18 +330,23 @@ Any conforming `SubtleCrypto` works. The package does not require `Buffer`.
292
330
  ```ts
293
331
  import {
294
332
  createEncryptedBuyerTeeSessionMaterial,
333
+ createEncryptedDisputeSessionMaterial,
295
334
  createEncryptedIdentitySessionMaterial,
296
335
  createEncryptedSellerCredentialUpload,
297
336
  encryptBuyerTeeSessionMaterial,
337
+ encryptDisputeSessionMaterial,
298
338
  encryptIdentitySessionMaterial,
299
339
  encryptSellerCredentialUpload,
300
340
  fetchAndVerifyAttestation,
301
341
  getUnifiedPaymentVerifierDomainSeparator,
342
+ getDisputeVerifierDomainSeparator,
302
343
  hashUtf8,
303
344
  requestIdentityAttestation,
304
345
  uploadSellerCredential,
305
346
  verifyBuyerTeePaymentAttestation,
306
347
  verifyBuyerTeePayment,
348
+ verifyDispute,
349
+ verifyDisputeAttestation,
307
350
  verifyIdentityAttestation,
308
351
  verifySellerCredentialBundle,
309
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