@reclaimprotocol/js-sdk 5.4.0 → 5.4.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/dist/index.d.ts CHANGED
@@ -51,6 +51,22 @@ interface ExtensionMessage {
51
51
  interface WitnessData {
52
52
  id: string;
53
53
  url: string;
54
+ claimAttestation?: AttestorClaimAttestation;
55
+ }
56
+ /**
57
+ * Attestation produced by an attestor running inside a Trusted Execution
58
+ * Environment. Binds the attestor's signing key (and its signature over
59
+ * the claim) to a hardware-backed enclave identity.
60
+ *
61
+ * Verified by `runAttestorTeeVerification`.
62
+ */
63
+ interface AttestorClaimAttestation {
64
+ /** ETH address of the attestor whose enclave produced the attestation. Matches `WitnessData.id`. */
65
+ attestor_address: string;
66
+ /** Attestor signature over the claim. Must equal the corresponding entry in `Proof.signatures`. */
67
+ claim_signature: string;
68
+ /** Raw attestation report. For GCP Confidential Space, a JWT (header.payload.signature). */
69
+ attestation_report: string;
54
70
  }
55
71
  interface ProviderClaimData {
56
72
  provider: string;
@@ -299,6 +315,59 @@ interface ResponseRedactionSpec {
299
315
  xPath: string;
300
316
  }
301
317
 
318
+ /**
319
+ * Result of verifying an attestor TEE attestation.
320
+ */
321
+ type AttestorTeeVerificationResult = {
322
+ isVerified: boolean;
323
+ error?: string;
324
+ /** sha256 image digest of the attestor container, on success. */
325
+ imageDigest?: string;
326
+ };
327
+ /**
328
+ * Validates a GCP Confidential Space attestation JWT produced by an
329
+ * attestor running in a Confidential Space VM, and asserts that the
330
+ * attestation binds to the given attestor address.
331
+ *
332
+ * The attestor (running inside the TEE) calls the Confidential Space
333
+ * launcher's attestation endpoint with two nonces:
334
+ * - `attestor_public_key:<eth-address>` - binds to the signing key.
335
+ * - `attestor_cert_hash:<sha256-hex>` - binds to the live TLS cert.
336
+ *
337
+ * This function only verifies the public-key nonce. The TLS cert hash
338
+ * binding is informational and not checked here. Callers that need to
339
+ * pin to a specific attestor image should compare the returned
340
+ * `imageDigest` against a known-good value.
341
+ *
342
+ * The JWT signature is verified by walking the x5c certificate chain
343
+ * to a pinned GCP Confidential Space Root CA. No outbound network
344
+ * calls are made.
345
+ *
346
+ * Node-only (uses node:crypto). Mirrors the environment restriction in
347
+ * the existing `verifyTeeAttestation` helper.
348
+ *
349
+ * @param report - the raw JWT string (header.payload.signature).
350
+ * @param expectedAttestorAddress - hex ETH address (0x-prefixed or
351
+ * unprefixed) that the attestation should be bound to.
352
+ */
353
+ declare function verifyAttestorTeeAttestation(report: string, expectedAttestorAddress: string): Promise<AttestorTeeVerificationResult>;
354
+ /**
355
+ * Configuration for verifying the attestor's TEE attestation on each
356
+ * witness of the proof.
357
+ */
358
+ type AttestorTeeAttestationConfig = {
359
+ /**
360
+ * Optional allowlist of expected attestor container image digests
361
+ * (e.g. `"sha256:4906340f..."`). When provided, the attestation's
362
+ * `submods.container.image_digest` must be in this list.
363
+ *
364
+ * Leave undefined to skip image pinning and rely solely on the JWT
365
+ * chain rooting to the GCP Confidential Space Root CA + nonce
366
+ * binding to the attestor address.
367
+ */
368
+ expectedImageDigests?: string[];
369
+ };
370
+
302
371
  /**
303
372
  * Content validation configuration specifying essential required hashes and optional extra proofs.
304
373
  * Used to explicitly validate that a generated proof matches the exact request structure expected.
@@ -378,6 +447,20 @@ type VerificationConfig = ValidationConfig & {
378
447
  * if TEE attestation data is missing or verification fails.
379
448
  */
380
449
  teeAttestation?: TeeAttestationConfig;
450
+ /**
451
+ * Attestor TEE attestation verification configuration.
452
+ * When provided, verifies that every witness on every proof has a valid
453
+ * `claimAttestation` from an attestor running inside a TEE (GCP
454
+ * Confidential Space).
455
+ *
456
+ * Independent of `teeAttestation`, which verifies the verifier-app's
457
+ * own TEE attestation. Both can be enabled together.
458
+ *
459
+ * The result will include `isAttestorTeeAttestationVerified` and
460
+ * `isVerified` will be false if any witness is missing TEE attestation
461
+ * data or its verification fails.
462
+ */
463
+ attestorTeeAttestation?: AttestorTeeAttestationConfig;
381
464
  };
382
465
  declare function assertValidProofsByHash(proofs: Proof[], config: ProviderHashRequirementsConfig): void;
383
466
  declare function isHttpProviderClaimParams(claimParams: unknown): claimParams is HttpProviderClaimParams;
@@ -703,6 +786,7 @@ type TrustedData = {
703
786
  type VerifyProofResultSuccess = {
704
787
  isVerified: true;
705
788
  isTeeAttestationVerified?: boolean;
789
+ isAttestorTeeAttestationVerified?: boolean;
706
790
  error: undefined;
707
791
  data: TrustedData[];
708
792
  publicData: any[];
@@ -710,6 +794,7 @@ type VerifyProofResultSuccess = {
710
794
  type VerifyProofResultFailure = {
711
795
  isVerified: false;
712
796
  isTeeAttestationVerified?: boolean;
797
+ isAttestorTeeAttestationVerified?: boolean;
713
798
  error: Error;
714
799
  data: [];
715
800
  publicData: [];
@@ -1634,4 +1719,4 @@ declare function isDesktopDevice(): boolean;
1634
1719
  */
1635
1720
  declare function clearDeviceCache(): void;
1636
1721
 
1637
- export { type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type EmbeddedFlowHandle, type ExtensionMessage, type FlowHandle, type HashRequirement, type HashableHttpProviderClaimParams, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type InjectedRequestSpec, type InterceptorRequestSpec, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderHashRequirementSpec, type ProviderHashRequirementsConfig, type ProviderHashRequirementsResponse, type ProviderVersionConfig, type ProviderVersionInfo, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowInitOptions, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type ReclaimProviderConfigWithRequestSpec, type RequestSpec, type ResponseMatchSpec, type ResponseRedactionSpec, SUPPORTED_TEE_ATTESTATION_VERSIONS, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TeeAttestation, type TeeAttestationConfig, type TeeAttestationVersion, TeeVerificationError, type TeeVerificationResult, type TemplateData, type TrustedData, type UpdateSessionResponse, type ValidationConfig, type ValidationConfigWithDisabledValidation, type ValidationConfigWithHash, type ValidationConfigWithProviderInformation, type VerificationConfig, type VerifyProofResult, type VerifyProofResultFailure, type VerifyProofResultSuccess, type WitnessData, assertValidProofsByHash, assertValidateProof, assertVerifiedProof, clearDeviceCache, createLinkWithTemplateData, createSignDataForClaim, fetchProviderConfigs, fetchProviderHashRequirementsBy, fetchStatusUrl, generateAttestationNonce, generateInitSignature, generateSpecsFromRequestSpecTemplate, getAttestors, getDeviceType, getHttpProviderClaimParamsFromProof, getIdentifierFromClaimInfo, getMobileDeviceType, getProviderHashRequirementSpecFromProviderConfig, getProviderHashRequirementsFromSpec, getProviderParamsAsCanonicalizedString, getShortenedUrl, hashProofClaimParams, hashRequestSpec, initSession, isDesktopDevice, isHttpProviderClaimParams, isMobileDevice, recoverSignersOfSignedClaim, runTeeVerification, takePairsWhereValueIsArray, takeTemplateParametersFromProofs, transformForOnchain, updateSession, verifyProof, verifyTeeAttestation };
1722
+ export { type AttestorClaimAttestation, type AttestorTeeVerificationResult, type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type EmbeddedFlowHandle, type ExtensionMessage, type FlowHandle, type HashRequirement, type HashableHttpProviderClaimParams, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type InjectedRequestSpec, type InterceptorRequestSpec, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderHashRequirementSpec, type ProviderHashRequirementsConfig, type ProviderHashRequirementsResponse, type ProviderVersionConfig, type ProviderVersionInfo, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowInitOptions, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type ReclaimProviderConfigWithRequestSpec, type RequestSpec, type ResponseMatchSpec, type ResponseRedactionSpec, SUPPORTED_TEE_ATTESTATION_VERSIONS, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TeeAttestation, type TeeAttestationConfig, type TeeAttestationVersion, TeeVerificationError, type TeeVerificationResult, type TemplateData, type TrustedData, type UpdateSessionResponse, type ValidationConfig, type ValidationConfigWithDisabledValidation, type ValidationConfigWithHash, type ValidationConfigWithProviderInformation, type VerificationConfig, type VerifyProofResult, type VerifyProofResultFailure, type VerifyProofResultSuccess, type WitnessData, assertValidProofsByHash, assertValidateProof, assertVerifiedProof, clearDeviceCache, createLinkWithTemplateData, createSignDataForClaim, fetchProviderConfigs, fetchProviderHashRequirementsBy, fetchStatusUrl, generateAttestationNonce, generateInitSignature, generateSpecsFromRequestSpecTemplate, getAttestors, getDeviceType, getHttpProviderClaimParamsFromProof, getIdentifierFromClaimInfo, getMobileDeviceType, getProviderHashRequirementSpecFromProviderConfig, getProviderHashRequirementsFromSpec, getProviderParamsAsCanonicalizedString, getShortenedUrl, hashProofClaimParams, hashRequestSpec, initSession, isDesktopDevice, isHttpProviderClaimParams, isMobileDevice, recoverSignersOfSignedClaim, runTeeVerification, takePairsWhereValueIsArray, takeTemplateParametersFromProofs, transformForOnchain, updateSession, verifyAttestorTeeAttestation, verifyProof, verifyTeeAttestation };