wallaby-cash 3.22.0 → 4.0.0-rc.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 +27 -27
- package/dist/api.cjs +1 -1
- package/dist/api.js +1 -1
- package/dist/api.mjs +1 -1
- package/dist/base.d.ts +11 -3
- package/dist/generated/api.d.ts +566 -1551
- package/dist/generated/validators.d.ts +4 -4
- package/dist/helpers/bytes.d.ts +2 -0
- package/dist/helpers/ed25519-hd.d.ts +11 -0
- package/dist/helpers/logger.d.ts +1 -1
- package/dist/helpers/pick.d.ts +1 -0
- package/dist/index.cjs +13 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -11
- package/dist/index.mjs.map +1 -1
- package/dist/lib/attestation/attestation.service.d.ts +6 -11
- package/dist/lib/attestation/identity-signature.d.ts +17 -1
- package/dist/lib/attestation/index.d.ts +6 -2
- package/dist/lib/attestation/verify-sealed-derivation-response.d.ts +36 -0
- package/dist/lib/attestation/verify-sealed-seed-response.d.ts +80 -0
- package/dist/lib/attestation/verify-sealed-signing-response.d.ts +56 -6
- package/dist/lib/auth/auth.service.d.ts +1 -1
- package/dist/lib/auth/device-key.d.ts +26 -0
- package/dist/lib/sealed/sealed-nonce-ledger.d.ts +35 -0
- package/dist/lib/sealed/sealed-session.d.ts +38 -0
- package/dist/lib/swap/index.d.ts +5 -18
- package/dist/lib/swap/sealed-swap-intent.d.ts +44 -0
- package/dist/lib/transactions/index.d.ts +30 -63
- package/dist/lib/transactions/sealed-signing.schemas.d.ts +20 -6
- package/dist/lib/utils/cipher-core.d.ts +6 -0
- package/dist/lib/utils/cipher.service.d.ts +4 -57
- package/dist/lib/utils/constants.d.ts +2 -0
- package/dist/lib/wallet/derived-address.d.ts +9 -0
- package/dist/lib/wallet/wallet-data.service.d.ts +34 -11
- package/dist/lib/wallet/wallet-handlers.service.d.ts +101 -2
- package/dist/lib/wallet/wallet.service.d.ts +83 -22
- package/dist/package.json +8 -15
- package/dist/r/oci-BpYishbP.cjs +1 -0
- package/dist/r/oci-BpYishbP.cjs.map +1 -0
- package/dist/r/oci-DXErFBZ2.js +1 -0
- package/dist/r/oci-DXErFBZ2.js.map +1 -0
- package/dist/r/oci-DXErFBZ2.mjs +1 -0
- package/dist/r/oci-DXErFBZ2.mjs.map +1 -0
- package/dist/routes/auth.d.ts +5 -0
- package/dist/routes/swap.d.ts +0 -5
- package/dist/routes/transactions.d.ts +0 -20
- package/dist/routes/wallet.d.ts +5 -5
- package/dist/types/auth.d.ts +0 -1
- package/dist/types/base.d.ts +9 -12
- package/dist/types/common.d.ts +3 -0
- package/dist/types/error-response-codes.d.ts +15 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/sealed-derivation.d.ts +137 -0
- package/dist/types/sealed-seed.d.ts +119 -0
- package/dist/types/sealed-signing.d.ts +351 -36
- package/dist/types/storage.d.ts +3 -1
- package/dist/types/swap.d.ts +0 -18
- package/dist/types/transactions.d.ts +1 -42
- package/dist/types/verification.d.ts +15 -19
- package/dist/types/wallet.d.ts +43 -5
- package/dist/verification/algorand/sealed.d.ts +59 -0
- package/dist/verification/algorand/transaction.d.ts +19 -0
- package/dist/verification/aptos/sealed.d.ts +44 -0
- package/dist/verification/aptos/transaction.d.ts +45 -0
- package/dist/verification/bitcoin/sealed.d.ts +63 -0
- package/dist/verification/bitcoin/transaction.d.ts +89 -0
- package/dist/verification/canton/hash.d.ts +35 -0
- package/dist/verification/canton/packages.d.ts +17 -0
- package/dist/verification/canton/prepared-transaction.d.ts +16 -0
- package/dist/verification/canton/sealed.d.ts +108 -0
- package/dist/verification/canton/topology.d.ts +15 -0
- package/dist/verification/canton/transfer.d.ts +40 -0
- package/dist/verification/canton/verify.d.ts +36 -0
- package/dist/verification/chain-context.d.ts +26 -3
- package/dist/verification/codecs/base58.d.ts +11 -0
- package/dist/verification/codecs/bcs.d.ts +46 -0
- package/dist/verification/codecs/bech32.d.ts +18 -0
- package/dist/verification/codecs/units.d.ts +5 -0
- package/dist/verification/derivation-context.d.ts +131 -0
- package/dist/verification/evm/lifi.d.ts +92 -0
- package/dist/verification/evm/verify.d.ts +108 -10
- package/dist/verification/fee-ceiling-table.d.ts +50 -0
- package/dist/verification/fee-ceilings.d.ts +28 -0
- package/dist/verification/injective/sealed.d.ts +37 -0
- package/dist/verification/injective/transaction.d.ts +68 -0
- package/dist/verification/pinned-spenders.d.ts +42 -0
- package/dist/verification/polymesh/codecs.d.ts +146 -75
- package/dist/verification/polymesh/context.d.ts +27 -24
- package/dist/verification/polymesh/payload.d.ts +40 -0
- package/dist/verification/polymesh/sealed.d.ts +48 -0
- package/dist/verification/polymesh/ss58.d.ts +7 -0
- package/dist/verification/polymesh/verify.d.ts +13 -4
- package/dist/verification/sealed.d.ts +13 -0
- package/dist/verification/solana/address.d.ts +21 -0
- package/dist/verification/solana/instructions.d.ts +55 -0
- package/dist/verification/solana/message.d.ts +34 -0
- package/dist/verification/solana/sealed.d.ts +32 -0
- package/dist/verification/sui/sealed.d.ts +47 -0
- package/dist/verification/sui/transaction.d.ts +121 -0
- package/package.json +8 -15
- package/dist/r/oci-DmlO5Nzi.cjs +0 -1
- package/dist/r/oci-DmlO5Nzi.cjs.map +0 -1
- package/dist/r/oci-_5u5jJ2e.js +0 -1
- package/dist/r/oci-_5u5jJ2e.js.map +0 -1
- package/dist/r/oci-_5u5jJ2e.mjs +0 -1
- package/dist/r/oci-_5u5jJ2e.mjs.map +0 -1
- package/dist/verification/polymesh/base58.d.ts +0 -7
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ const wallaby = new Wallaby(config)
|
|
|
136
136
|
|
|
137
137
|
wallaby.auth.refreshAuthTokens()
|
|
138
138
|
wallaby.walletData.getTokenBalance(/* … */)
|
|
139
|
-
wallaby.transactions.
|
|
139
|
+
wallaby.transactions.prepare(/* intent */) // then wallaby.transactions.execute(prepared, authenticationOptions)
|
|
140
140
|
wallaby.system.getSupportedBlockchains()
|
|
141
141
|
```
|
|
142
142
|
|
|
@@ -180,36 +180,40 @@ discriminant (`'api' | 'network' | 'validation' | 'sdk'`) and a `toJSON()` for l
|
|
|
180
180
|
See [RUNTIME_VALIDATION.md](./RUNTIME_VALIDATION.md) for how it works, what's covered, and what's
|
|
181
181
|
still in progress.
|
|
182
182
|
|
|
183
|
-
## Enclave attestation verification
|
|
183
|
+
## Enclave attestation verification
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
Since **v4.0.0** (WAL-1808) the SDK sends seed or share material **only sealed to an attested enclave
|
|
186
|
+
session**: transaction signing (`transactions.prepare` / `transactions.execute`), address derivation
|
|
187
|
+
(`wallet.generateWalletAddresses`, the check `wallet.create` runs), `wallet.verifyAccess`, `wallet.import`,
|
|
188
|
+
`wallet.export` from a key share and `wallet.convertToPasskey`. There is no unsealed route left to fall back
|
|
189
|
+
to, so attestation is always enforced: `options.attestationVerification` accepts only `'throw'`, its default.
|
|
190
|
+
`'warn'` and `'off'` were removed and are refused at construction (`sdk_invalid_parameter`).
|
|
189
191
|
|
|
190
|
-
`
|
|
191
|
-
|
|
192
|
+
**Not covered yet: wallet creation.** `wallet.create` is still unattested. The enclave generates the seed and
|
|
193
|
+
the API relays it, and the shares, wrapped to this device's key, with no session and no signed receipt. The
|
|
194
|
+
address check `wallet.create` runs proves the addresses match the seed this device received, not that the API
|
|
195
|
+
can't also read that seed. A sealed create is follow-up work.
|
|
192
196
|
|
|
193
197
|
```javascript
|
|
194
198
|
const wallaby = new Wallaby({
|
|
195
199
|
...config,
|
|
196
|
-
options: { attestationVerification: 'throw' }, //
|
|
200
|
+
options: { attestationVerification: 'throw' }, // the default, and the only accepted value
|
|
197
201
|
});
|
|
198
202
|
```
|
|
199
203
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
Every sealed call opens its own session: the API returns a session attestation document with a fresh nonce,
|
|
205
|
+
and the SDK verifies it before any key material is decrypted, seals the material to the session's attested
|
|
206
|
+
key, and accepts the result only if the session signed it over the exact envelope sent. Any failure throws.
|
|
203
207
|
|
|
204
|
-
|
|
205
|
-
verified on echo)
|
|
208
|
+
For each sealed call the SDK verifies the session attestation document (a new CSPRNG nonce per call,
|
|
209
|
+
verified on echo) with the five checks: decode, certificate chain to the pinned AWS Nitro root,
|
|
206
210
|
ES384 signature, PCR0/1/2 triple against the enclave manifest's permitted builds, and nonce.
|
|
207
211
|
|
|
208
212
|
The permitted PCR triples are not baked into the SDK. They come from a signed manifest, shaped
|
|
209
213
|
`{ payload, signatures }`, that `resolveManifest()` finds in this order, **the first authentic one winning**:
|
|
210
214
|
|
|
211
|
-
1. **Network:** `GET https://enclave-manifest.wallaby.cash/manifest.json` (the `dev-` host
|
|
212
|
-
`options.environment`
|
|
215
|
+
1. **Network:** `GET https://enclave-manifest.wallaby.cash/manifest.json` (the `dev-` host only when
|
|
216
|
+
`options.environment` isn't `'production'` and `options.network` isn't `'mainnet'`), straight to the CDN and never through the Wallaby API.
|
|
213
217
|
2. **Cache:** the last verified envelope, kept in `options.storage` through the SDK's `StorageService`
|
|
214
218
|
(`saveGeneric` / `fetchGeneric`) under `wallaby-enclave-manifest-<env>`, encrypted with the SDK key and
|
|
215
219
|
verified again every time it is read. It is device-wide: the key carries no user id, so every user on the
|
|
@@ -233,23 +237,19 @@ signed by an unknown key, for the wrong environment, or simply empty. The reques
|
|
|
233
237
|
8 KB limit on the decoded response. You can read the verified PCRs yourself with
|
|
234
238
|
`getEnclavePcrs({ isProduction })`.
|
|
235
239
|
|
|
236
|
-
The same service is public as `wallaby.attestation`, for callers that want to verify on demand
|
|
237
|
-
gate requests: `await wallaby.attestation.verify()` fetches an attestation document (fresh nonce) and the
|
|
240
|
+
The same service is public as `wallaby.attestation`, for callers that want to verify the enclave on demand: `await wallaby.attestation.verify()` fetches an attestation document (fresh nonce) and the
|
|
238
241
|
signed manifest, runs all five checks, and returns `{ verified: true, documentInfo }` — the decoded, verified
|
|
239
242
|
attestation document, including its PCRs and the enclave identity public key — or throws as below.
|
|
240
243
|
|
|
241
|
-
|
|
244
|
+
A failed check is raised as the matching `AttestationVerificationError` subclass
|
|
242
245
|
(`AttestationDecodeError`, `AttestationChainError`, `AttestationSignatureError`, `AttestationPcrError`,
|
|
243
246
|
`AttestationNonceError`), whose `step` and `reason` name what failed.
|
|
244
247
|
|
|
245
|
-
The
|
|
246
|
-
`
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
wallet import, or wallet creation/recovery.
|
|
251
|
-
|
|
252
|
-
Each guarded request costs one extra round trip plus a certificate-chain verification.
|
|
248
|
+
The unsealed `swap.executeSwap` was removed in v4.0.0 with its API route. Execute a quote from `swap.getQuote`
|
|
249
|
+
through sealed signing instead: `transactions.prepare(sealedSwapIntent(quote, { walletId, originAddress }))`, then
|
|
250
|
+
`transactions.execute(prepared, authenticationOptions)` (WAL-2259). Swaps from Bitcoin and within one EVM chain are
|
|
251
|
+
supported; cross-chain EVM swaps and swaps from Solana and Sui are refused with `sdk_intent_unverifiable`. See
|
|
252
|
+
GUIDE.md, "Sealed swaps", for what the SDK checks. Quotes and history (`swap.getQuote`, `swap.getSwaps`) are unchanged.
|
|
253
253
|
|
|
254
254
|
## Generated API
|
|
255
255
|
|
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-BpYishbP.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-DXErFBZ2.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-DXErFBZ2.mjs";//# sourceMappingURL=api.mjs.map
|
package/dist/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthType, WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions, WallabyError, WallabyErrorPayload } from './types';
|
|
1
|
+
import { AuthType, WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions, WallabyError, WallabyErrorPayload, AttestationVerificationMode } from './types';
|
|
2
2
|
import { StorageService } from './lib/utils/storage.service';
|
|
3
3
|
import { LocalStorage } from './types/storage';
|
|
4
4
|
import { LockManagerService } from './helpers/lock-manager.service';
|
|
@@ -19,9 +19,17 @@ export declare abstract class Base {
|
|
|
19
19
|
private _localStorageService?;
|
|
20
20
|
protected api: GeneratedApiClient<any>;
|
|
21
21
|
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
22
|
+
/**
|
|
23
|
+
* Rotates the client JWT. The replacement (and the auth type it implies) reaches this service's generated client and
|
|
24
|
+
* every service it holds, at any depth, so a nested call such as the salt lookup a Canton registration's migration
|
|
25
|
+
* check makes never sends the JWT the service was constructed with.
|
|
26
|
+
*/
|
|
22
27
|
set setClientAuthToken(token: string);
|
|
28
|
+
private _rotateClientAuthToken;
|
|
29
|
+
/** The generated client sends the security data it was last given, so it is refreshed whenever the JWT changes. */
|
|
30
|
+
private _syncSecurityData;
|
|
23
31
|
get version(): string;
|
|
24
|
-
|
|
32
|
+
protected _initializeClientAuthToken(token: string): void;
|
|
25
33
|
/**
|
|
26
34
|
* This library uses `localStorage` as the default storage.
|
|
27
35
|
* If you want to use a different storage, you can pass it in the options object of the Wallaby config.
|
|
@@ -35,7 +43,7 @@ export declare abstract class Base {
|
|
|
35
43
|
* the signed enclave manifest is resolved without a cache when there is no storage engine.
|
|
36
44
|
*/
|
|
37
45
|
protected get localStorageServiceIfAvailable(): StorageService | undefined;
|
|
38
|
-
get attestationVerificationMode():
|
|
46
|
+
get attestationVerificationMode(): AttestationVerificationMode;
|
|
39
47
|
/**
|
|
40
48
|
* Whether the SDK is configured for production (`options.environment`, defaulting to `NODE_ENV`, is `'production'`).
|
|
41
49
|
* Selects which signed enclave manifest — and which trusted signing keys — apply.
|