wallaby-cash 3.20.0 → 3.21.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 +30 -11
- package/dist/api.cjs +1 -1
- package/dist/api.js +1 -1
- package/dist/api.mjs +1 -1
- package/dist/base.d.ts +5 -0
- package/dist/generated/enclave-manifest.d.ts +2 -0
- package/dist/generated/validate-manifest.d.ts +36 -0
- package/dist/helpers/redact.d.ts +17 -0
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/dist/lib/attestation/attestation.service.d.ts +8 -4
- package/dist/lib/auth/auth.service.d.ts +8 -1
- package/dist/lib/enclave/constants.d.ts +44 -9
- package/dist/lib/enclave/errors.d.ts +45 -12
- package/dist/lib/enclave/index.d.ts +6 -6
- package/dist/lib/enclave/manifest.d.ts +58 -33
- package/dist/lib/enclave/verify.d.ts +2 -1
- package/dist/lib/utils/storage.service.d.ts +37 -8
- package/dist/package.json +4 -1
- package/dist/r/oci-BEf504pW.cjs +1 -0
- package/dist/r/oci-BEf504pW.cjs.map +1 -0
- package/dist/r/oci-CEYiqAgR.js +1 -0
- package/dist/r/oci-CEYiqAgR.js.map +1 -0
- package/dist/r/oci-CEYiqAgR.mjs +1 -0
- package/dist/r/oci-CEYiqAgR.mjs.map +1 -0
- package/dist/types/error-response-codes.d.ts +1 -0
- package/dist/types/storage.d.ts +3 -1
- package/package.json +4 -1
- package/dist/lib/enclave/spki.d.ts +0 -10
- package/dist/r/oci-41IbhfX7.cjs +0 -1
- package/dist/r/oci-41IbhfX7.cjs.map +0 -1
- package/dist/r/oci-DDfN2lh2.js +0 -1
- package/dist/r/oci-DDfN2lh2.js.map +0 -1
- package/dist/r/oci-DDfN2lh2.mjs +0 -1
- package/dist/r/oci-DDfN2lh2.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -183,11 +183,9 @@ 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
|
|
187
|
-
>
|
|
188
|
-
>
|
|
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.
|
|
186
|
+
> behavior change. Its presence is **not** the attestation guarantee having landed: the binding between
|
|
187
|
+
> the attested identity and the keys seed material is encrypted to is still being rolled out. Don't treat
|
|
188
|
+
> enabling it as a security boundary yet.
|
|
191
189
|
|
|
192
190
|
`options.attestationVerification` makes the SDK verify the enclave's image **before** it decrypts
|
|
193
191
|
and re-encrypts any seed material for transport to it:
|
|
@@ -207,12 +205,33 @@ On each guarded request the SDK fetches a fresh attestation document (a new CSPR
|
|
|
207
205
|
verified on echo) and runs the five checks: decode, certificate chain to the pinned AWS Nitro root,
|
|
208
206
|
ES384 signature, PCR0/1/2 triple against the enclave manifest's permitted builds, and nonce.
|
|
209
207
|
|
|
210
|
-
The permitted PCR triples are not baked into the SDK. They come from a signed manifest
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
208
|
+
The permitted PCR triples are not baked into the SDK. They come from a signed manifest, shaped
|
|
209
|
+
`{ payload, signatures }`, that `resolveManifest()` finds in this order, **the first authentic one winning**:
|
|
210
|
+
|
|
211
|
+
1. **Network:** `GET https://enclave-manifest.wallaby.cash/manifest.json` (the `dev-` host unless
|
|
212
|
+
`options.environment` is `'production'`), straight to the CDN and never through the Wallaby API.
|
|
213
|
+
2. **Cache:** the last verified envelope, kept in `options.storage` through the SDK's `StorageService`
|
|
214
|
+
(`saveGeneric` / `fetchGeneric`) under `wallaby-enclave-manifest-<env>`, encrypted with the SDK key and
|
|
215
|
+
verified again every time it is read. It is device-wide: the key carries no user id, so every user on the
|
|
216
|
+
device shares it. Missing or failing storage only means no cache.
|
|
217
|
+
3. **Embedded (last resort):** the envelope shipped inside the SDK for this environment (committed in
|
|
218
|
+
`src/generated/enclave-manifest.ts` and verified like the others), so a fresh install with empty storage
|
|
219
|
+
and no network still resolves one. It can be older than the published manifest: nothing in CI or the
|
|
220
|
+
release flow requires it to be current, and it is only used when the network and the cache both fail.
|
|
221
|
+
Maintainers refresh it with `npm run embed:manifest`.
|
|
222
|
+
|
|
223
|
+
A manifest is authentic when it passes the shared validator, at least one of its signatures (secp256k1
|
|
224
|
+
over `sha256(payload)`) verifies under a key embedded in the SDK for this environment (a signing key and an
|
|
225
|
+
offline recovery key, either of which is enough), and its signed `env` is this environment. Signatures
|
|
226
|
+
from keys this SDK does not know are ignored rather than rejected, so a manifest co-signed by a newer
|
|
227
|
+
rotation key still works on older SDKs. There is no expiry
|
|
228
|
+
and no freshness check: every authentic manifest for the environment is safe to use, and revocation lives
|
|
229
|
+
in the KMS key policy, so a stale manifest can only cost availability. If none of the three sources is
|
|
230
|
+
authentic, `resolveManifest()` throws `EnclaveManifestUnavailable` (`errorCode`
|
|
231
|
+
`sdk_enclave_manifest_unavailable`), whose `failures` say per source whether it was unreachable, invalid,
|
|
232
|
+
signed by an unknown key, for the wrong environment, or simply empty. The request has a timeout and an
|
|
233
|
+
8 KB limit on the decoded response. You can read the verified PCRs yourself with
|
|
234
|
+
`getEnclavePcrs({ isProduction })`.
|
|
216
235
|
|
|
217
236
|
The same service is public as `wallaby.attestation`, for callers that want to verify on demand rather than
|
|
218
237
|
gate requests: `await wallaby.attestation.verify()` fetches an attestation document (fresh nonce) and the
|
package/dist/api.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./r/oci-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./r/oci-BEf504pW.cjs");exports.Api=e.A,exports.HttpClient=e.H;//# sourceMappingURL=api.cjs.map
|
package/dist/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as Api,H as HttpClient}from"./r/oci-
|
|
1
|
+
export{A as Api,H as HttpClient}from"./r/oci-CEYiqAgR.js";//# sourceMappingURL=api.js.map
|
package/dist/api.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as Api,H as HttpClient}from"./r/oci-
|
|
1
|
+
export{A as Api,H as HttpClient}from"./r/oci-CEYiqAgR.mjs";//# sourceMappingURL=api.mjs.map
|
package/dist/base.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export declare abstract class Base {
|
|
|
30
30
|
* }
|
|
31
31
|
*/
|
|
32
32
|
get deviceLocalStorage(): LocalStorage;
|
|
33
|
+
/**
|
|
34
|
+
* The `StorageService` when one can be built, otherwise `undefined`. Unlike `localStorageService` it never throws:
|
|
35
|
+
* the signed enclave manifest is resolved without a cache when there is no storage engine.
|
|
36
|
+
*/
|
|
37
|
+
protected get localStorageServiceIfAvailable(): StorageService | undefined;
|
|
33
38
|
get attestationVerificationMode(): import("./types").AttestationVerificationMode;
|
|
34
39
|
/**
|
|
35
40
|
* Whether the SDK is configured for production (`options.environment`, defaulting to `NODE_ENV`, is `'production'`).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const SCHEMA_VERSION = 1;
|
|
2
|
+
export declare const ENVIRONMENTS: readonly ["dev", "prod"];
|
|
3
|
+
export declare const MAX_PAYLOAD_BYTES = 4096;
|
|
4
|
+
export declare const MAX_ENVELOPE_BYTES = 8192;
|
|
5
|
+
export declare const MAX_BUILDS = 8;
|
|
6
|
+
export declare const MAX_SIGNATURES = 3;
|
|
7
|
+
export declare const MAX_SIGNATURE_BYTES = 72;
|
|
8
|
+
export type Environment = (typeof ENVIRONMENTS)[number];
|
|
9
|
+
export type Build = {
|
|
10
|
+
release: string;
|
|
11
|
+
gitSha: string;
|
|
12
|
+
pcr0: string;
|
|
13
|
+
pcr1: string;
|
|
14
|
+
pcr2: string;
|
|
15
|
+
addedAt: string;
|
|
16
|
+
};
|
|
17
|
+
export type Payload = {
|
|
18
|
+
schema: number;
|
|
19
|
+
env: Environment;
|
|
20
|
+
issuedAt: string;
|
|
21
|
+
builds: Build[];
|
|
22
|
+
};
|
|
23
|
+
export type Envelope = {
|
|
24
|
+
payload: Uint8Array;
|
|
25
|
+
signatures: Uint8Array[];
|
|
26
|
+
};
|
|
27
|
+
export type Result<T> = {
|
|
28
|
+
ok: true;
|
|
29
|
+
value: T;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
rule: string;
|
|
33
|
+
detail: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function validatePayload(bytes: Uint8Array): Result<Payload>;
|
|
36
|
+
export declare function validateEnvelope(bytes: Uint8Array): Result<Envelope>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redaction for log output.
|
|
3
|
+
*
|
|
4
|
+
* `redactSecrets` returns a copy of any value with key material and bearer tokens replaced by `'[redacted]'`, so a
|
|
5
|
+
* response body, a key pair, or an error that carries either can be handed to the logger as is. It has no
|
|
6
|
+
* dependencies, never mutates its input, and copes with cycles, typed arrays, errors, maps and sets.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REDACTED = "[redacted]";
|
|
9
|
+
export declare const isSecretKey: (key: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a copy of `value` that is safe to log: every property named in {@link SECRET_KEYS} is replaced by
|
|
12
|
+
* `'[redacted]'` at any depth, as is every typed array, `ArrayBuffer` and `DataView` (raw bytes are key material far
|
|
13
|
+
* more often than not) and every JWT found inside a string. `null` and `undefined` stay as they are even under a
|
|
14
|
+
* secret key, so a log line still shows whether a field was present. A reference back to an ancestor becomes
|
|
15
|
+
* `'[circular]'`. Errors keep their prototype, message and stack, with their own properties redacted.
|
|
16
|
+
*/
|
|
17
|
+
export declare function redactSecrets(value: unknown): unknown;
|