wallaby-cash 3.18.0 → 3.20.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/README.md CHANGED
@@ -183,9 +183,11 @@ still in progress.
183
183
  ## Enclave attestation verification (opt-in)
184
184
 
185
185
  > **Opt-in and not yet load-bearing.** This is off by default, so existing integrations see no
186
- > behavior change. Its presence is **not** the attestation guarantee having landed: the pinned
187
- > measurements and the binding between the attested identity and the keys seed material is
188
- > encrypted to are still being rolled out. Don't treat enabling it as a security boundary yet.
186
+ > behavior change. Its presence is **not** the attestation guarantee having landed: the production
187
+ > manifest-signing keys (until they are embedded, a production SDK fails closed with an
188
+ > `EnclaveManifestError` whose `reason` is `keys-not-configured`) and the binding between the attested
189
+ > identity and the keys seed material is encrypted to are still being rolled out. Don't treat enabling
190
+ > it as a security boundary yet.
189
191
 
190
192
  `options.attestationVerification` makes the SDK verify the enclave's image **before** it decrypts
191
193
  and re-encrypts any seed material for transport to it:
@@ -203,7 +205,19 @@ const wallaby = new Wallaby({
203
205
 
204
206
  On each guarded request the SDK fetches a fresh attestation document (a new CSPRNG nonce per call,
205
207
  verified on echo) and runs the five checks: decode, certificate chain to the pinned AWS Nitro root,
206
- ES384 signature, PCR0/1/2 triple against the pinned allowlist, and nonce.
208
+ ES384 signature, PCR0/1/2 triple against the enclave manifest's permitted builds, and nonce.
209
+
210
+ The permitted PCR triples are not baked into the SDK. They come from a signed manifest fetched from
211
+ a hardcoded endpoint (`https://enclave-manifest.wallaby.cash/manifest.json`, or the `dev-` host unless
212
+ `options.environment` is `'production'`) shaped `{ payload, signatures }`. The SDK base64-decodes the
213
+ payload, verifies a secp256k1 signature over `sha256(payload)` against the trusted keys embedded in the
214
+ SDK, and only then reads its `builds`. Any failure raises an `EnclaveManifestError` (fail closed). You can
215
+ read the verified PCRs yourself with `getEnclavePcrs({ isProduction })`.
216
+
217
+ The same service is public as `wallaby.attestation`, for callers that want to verify on demand rather than
218
+ gate requests: `await wallaby.attestation.verify()` fetches an attestation document (fresh nonce) and the
219
+ signed manifest, runs all five checks, and returns `{ verified: true, documentInfo }` — the decoded, verified
220
+ attestation document, including its PCRs and the enclave identity public key — or throws as below.
207
221
 
208
222
  In `'throw'` mode a failed check is raised as the matching `AttestationVerificationError` subclass
209
223
  (`AttestationDecodeError`, `AttestationChainError`, `AttestationSignatureError`, `AttestationPcrError`,
package/dist/base.d.ts CHANGED
@@ -31,6 +31,11 @@ export declare abstract class Base {
31
31
  */
32
32
  get deviceLocalStorage(): LocalStorage;
33
33
  get attestationVerificationMode(): import("./types").AttestationVerificationMode;
34
+ /**
35
+ * Whether the SDK is configured for production (`options.environment`, defaulting to `NODE_ENV`, is `'production'`).
36
+ * Selects which signed enclave manifest — and which trusted signing keys — apply.
37
+ */
38
+ protected get isProductionEnvironment(): boolean;
34
39
  private get validationMode();
35
40
  /**
36
41
  * @private