passkey-kit 0.14.0 → 0.16.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 +13 -12
- package/dist/constants.d.ts +16 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +16 -5
- package/dist/constants.js.map +1 -1
- package/dist/indexer/mercury.d.ts.map +1 -1
- package/dist/indexer/mercury.js +12 -4
- package/dist/indexer/mercury.js.map +1 -1
- package/dist/kit/deploy-ops.d.ts +9 -7
- package/dist/kit/deploy-ops.d.ts.map +1 -1
- package/dist/kit/deploy-ops.js +11 -8
- package/dist/kit/deploy-ops.js.map +1 -1
- package/dist/kit/tx-ops.d.ts +4 -4
- package/dist/kit/tx-ops.d.ts.map +1 -1
- package/dist/kit/tx-ops.js +14 -5
- package/dist/kit/tx-ops.js.map +1 -1
- package/dist/kit.d.ts +39 -9
- package/dist/kit.d.ts.map +1 -1
- package/dist/kit.js +99 -36
- package/dist/kit.js.map +1 -1
- package/dist/managers/submission-manager.d.ts +12 -17
- package/dist/managers/submission-manager.d.ts.map +1 -1
- package/dist/managers/submission-manager.js +77 -19
- package/dist/managers/submission-manager.js.map +1 -1
- package/dist/relayer.d.ts +2 -2
- package/dist/relayer.js +2 -2
- package/dist/server.d.ts +4 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -5
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +14 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +18 -2
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A TypeScript SDK for creating and using **smart-wallet accounts on Stellar with
|
|
|
9
9
|
> **Security.** Review the contract and SDK yourself before holding meaningful value, and read [Caveats](#caveats).
|
|
10
10
|
|
|
11
11
|
> [!NOTE]
|
|
12
|
-
> **Looking for context rules, thresholds, and spending-limit policies?** [smart-account-kit](https://github.com/
|
|
12
|
+
> **Looking for context rules, thresholds, and spending-limit policies?** [smart-account-kit](https://github.com/stellar/smart-account-kit) is a sibling SDK built on the audited [OpenZeppelin stellar-contracts](https://github.com/OpenZeppelin/stellar-contracts) account. It uses a different on-chain authorization model (context rules + an auth digest) than passkey-kit's flat `Signatures` map, so the two are not drop-in compatible — pick the model that fits your app.
|
|
13
13
|
|
|
14
14
|
## Contents
|
|
15
15
|
|
|
@@ -147,8 +147,9 @@ Browser-side facade for wallet lifecycle and signing. Holds no secrets.
|
|
|
147
147
|
| `rpcUrl` | `string` | Yes | Stellar RPC URL. |
|
|
148
148
|
| `networkPassphrase` | `string` | Yes | Network passphrase. |
|
|
149
149
|
| `walletWasmHash` | `string` (hex) | Yes | Smart-wallet WASM hash used to deploy new wallets. |
|
|
150
|
+
| `acceptedWasmHashes` | `string[]` (hex) | No | Code identities accepted when connecting to a wallet resolved from an untrusted source (indexer lookup or derivation). Defaults to `[walletWasmHash]`. Add each hash as upgrades roll out — see [security notes](./docs/security-deterministic-deployer.md). |
|
|
150
151
|
| `rpId` | `string` | No | WebAuthn Relying Party id (domain). Defaults to the current origin. |
|
|
151
|
-
| `deploySource` | `string` (`S…`) | No | Secret key for
|
|
152
|
+
| `deploySource` | `string` (`S…`) | No | Secret key for a deployer you control, which then sources and pays for its own deployments. Defaults to the canonical deterministic deployer, which is sign-only and never pays. **Overriding it changes derived wallet addresses** (see [Deterministic derivation](#deterministic-derivation)). |
|
|
152
153
|
| `timeoutInSeconds` | `number` | No | Transaction time bound (default `30`; the relayer requires `<= 30`). |
|
|
153
154
|
| `storage` | `StorageAdapter` | No | Passkey-record persistence (see [Storage adapters](#storage-adapters)). |
|
|
154
155
|
| `WebAuthn` | `WebAuthnClient` | No | Custom `startRegistration`/`startAuthentication` (for testing). |
|
|
@@ -160,7 +161,7 @@ Browser-side facade for wallet lifecycle and signing. Holds no secrets.
|
|
|
160
161
|
| `keyId` | `string \| undefined` | Connected passkey's base64url credential id. |
|
|
161
162
|
| `wallet` | `PasskeyClient \| undefined` | Connected wallet's generated contract client. |
|
|
162
163
|
| `contractId` | `string \| undefined` | Connected wallet address (getter). |
|
|
163
|
-
| `deployerPublicKey` | `string` | The
|
|
164
|
+
| `deployerPublicKey` | `string` | The deployer's `G…` address (getter). Pays only when it is a custom `deploySource`. |
|
|
164
165
|
| `networkPassphrase` / `rpcUrl` / `walletWasmHash` / `rpId` | `string` | The resolved config. |
|
|
165
166
|
| `events` | `PasskeyEventEmitter` | Lifecycle events: `walletCreated`, `walletConnected`, `walletDisconnected`. |
|
|
166
167
|
|
|
@@ -169,8 +170,8 @@ Browser-side facade for wallet lifecycle and signing. Holds no secrets.
|
|
|
169
170
|
| Method | Returns | Description |
|
|
170
171
|
|---|---|---|
|
|
171
172
|
| `createKey(appName, userName, options?)` | `CreatedPasskey` | Run a passkey registration ceremony **without** deploying a wallet. |
|
|
172
|
-
| `createWallet(appName, userName, options?)` | `CreateWalletResult` | Register a passkey and build a
|
|
173
|
-
| `connectWallet(options?)` | `ConnectWalletResult` | Resolve a wallet from a passkey (
|
|
173
|
+
| `createWallet(appName, userName, options?)` | `CreateWalletResult` | Register a passkey and build a deploy carrier (initializes the wallet via `__constructor` with the passkey as the first signer). For the shared deployer the carrier holds a signed authorization entry and no envelope signature. Submit the returned `signedTx` via `PasskeyServer`. |
|
|
174
|
+
| `connectWallet(options?)` | `ConnectWalletResult` | Resolve a wallet from a passkey (local storage → injected indexer lookup → deterministic derivation) and **verify** the passkey is a live signer on it. |
|
|
174
175
|
| `disconnect()` | `void` | Clear the connected wallet/keyId. |
|
|
175
176
|
| `requireWallet()` | `PasskeyClient` | Return the connected wallet or throw `WalletNotConnectedError`. |
|
|
176
177
|
|
|
@@ -181,8 +182,8 @@ Browser-side facade for wallet lifecycle and signing. Holds no secrets.
|
|
|
181
182
|
| Option | Type | Description |
|
|
182
183
|
|---|---|---|
|
|
183
184
|
| `keyId` | `string \| Uint8Array` | Connect a specific credential, skipping the discovery ceremony. |
|
|
184
|
-
| `getContractId` | `(keyId: string) => Promise<string \| undefined>` | Indexer-backed keyId → wallet lookup,
|
|
185
|
-
| `verifyWasmHash` | `boolean` |
|
|
185
|
+
| `getContractId` | `(keyId: string) => Promise<string \| undefined>` | Indexer-backed keyId → wallet lookup, tried after local storage and before deterministic derivation. |
|
|
186
|
+
| `verifyWasmHash` | `boolean` | Override the code-identity check against `acceptedWasmHashes`. Defaults to **on** for an address resolved from an untrusted source (indexer or derivation) and **off** for one from trusted local storage, where an upgraded wallet would otherwise be locked out. `true` checks even a stored address; `false` skips the check entirely. |
|
|
186
187
|
|
|
187
188
|
### Signing methods
|
|
188
189
|
|
|
@@ -305,7 +306,7 @@ All wallet writes are fee-sponsored by the [OpenZeppelin Relayer Channels](https
|
|
|
305
306
|
Two submission modes are chosen automatically:
|
|
306
307
|
|
|
307
308
|
- **`{ func, auth }`** (`submitSorobanTransaction`) — for wallet invocations (transfers, signer management) whose auth is carried by Address credentials. The relayer builds the envelope.
|
|
308
|
-
- **`{ xdr }`** (`submitTransaction`) — for an already-signed envelope that needs a fee bump (deploys / source-account auth).
|
|
309
|
+
- **`{ xdr }`** (`submitTransaction`) — for an already-signed envelope that needs a fee bump (custom-`deploySource` deploys / source-account auth). Shared-deployer deploys never take this path.
|
|
309
310
|
|
|
310
311
|
### Browsers: the relayer-proxy worker
|
|
311
312
|
|
|
@@ -313,7 +314,7 @@ The relayer API key is a secret, so a browser must never hold it. The [`relayer-
|
|
|
313
314
|
|
|
314
315
|
## Discovery (indexer)
|
|
315
316
|
|
|
316
|
-
|
|
317
|
+
The "reconnect" path needs no indexer: `connectWallet` resolves from a stored passkey → wallet association or, failing that, deterministic derivation (see [Deterministic derivation](#deterministic-derivation)), then confirms ownership on-chain. Derivation is a last resort because it is only correct for a wallet's first credential and is the one resolution path a squatted contract can hijack — trusted storage wins. An indexer is for **richer discovery**: enumerating a wallet's full signer set, and reverse-looking-up which wallets a given signer belongs to.
|
|
317
318
|
|
|
318
319
|
The SDK abstracts discovery behind a `SignerIndexer` interface (`getSigners` / `findWallets` / `health`), implemented by the **keyless** `MercuryIndexer` — exported from the main `passkey-kit` entry (no secret, so it runs in the browser):
|
|
319
320
|
|
|
@@ -452,8 +453,8 @@ Signer and signature expiration are **UNIX timestamps in seconds** (inclusive: v
|
|
|
452
453
|
> These are inherent to the wallet model. The SDK does not guard against them — handle them in your app.
|
|
453
454
|
|
|
454
455
|
- **Keep at least one durable admin signer.** The contract rejects any change that would remove or demote its last durable (`Persistent`, non-expiring) admin signer (`LastAdminSigner = 103`) or leave it without any durable signer (`LastSigner = 104`), so a wallet always retains one signer that cannot evict or expire. Signers outside that guard — `Temporary` storage or with an expiration — lapse on their own: add a replacement *before* removing or demoting an existing signer.
|
|
455
|
-
- **The default deployer is a shared, public keypair.** It only
|
|
456
|
-
- **Deploy front-running.**
|
|
456
|
+
- **The default deployer is a shared, public keypair — its secret is publicly derivable.** It salts deployment and signs only the CreateContractV2 authorization entry; the relayer supplies the envelope source, sequence, and fees. It never controls the wallet. Its determinism is load-bearing for discovery: overriding `deploySource` changes every derived address and breaks keyId → wallet lookup. Use a separate funded `restoreSource` for `restoreFootprint`; never fund the shared deployer. A third-party `bumpSequence` to `INT64_MAX` no longer blocks the current SDK because it never uses the shared deployer as an envelope source. Full analysis: [`docs/security-deterministic-deployer.md`](docs/security-deterministic-deployer.md).
|
|
457
|
+
- **Deploy front-running remains an accepted residual.** Anyone who learns a `keyId` before deployment could place arbitrary code at the derived address. A signer getter check alone is not proof of ownership, because arbitrary code can answer it however the client expects. Since `0.16.0` `connectWallet` binds accepted code identity (`acceptedWasmHashes`) before reading any signer state, for any address that did not come from trusted local storage. A derivation-resolved address is still not authenticated by that check alone — see the [security analysis](docs/security-deterministic-deployer.md#accepted-residual-address-squatting).
|
|
457
458
|
- **WebAuthn requires User Presence (UP), not User Verification (UV).** The contract requires the UP flag but not UV (biometric/PIN), so it stays compatible with non-UV authenticators. Enforce UV at the client/relayer layer if you need it.
|
|
458
459
|
- **Value-moving policies need a cumulative cap or a co-signer.** A `Signature::Policy` carries no secret, so a per-transfer cap alone is trivially drained by repeated capped transfers. See the [contract interface](#contract-interface) and `sample-policy`.
|
|
459
460
|
|
|
@@ -487,7 +488,7 @@ contractId = sha256(XDR(HashIdPreimage::EnvelopeTypeContractId {
|
|
|
487
488
|
}))
|
|
488
489
|
```
|
|
489
490
|
|
|
490
|
-
- The canonical deployer keypair is `Keypair.fromRawEd25519Seed(sha256("kalepail"))`. It
|
|
491
|
+
- The canonical deployer keypair is `Keypair.fromRawEd25519Seed(sha256("kalepail"))`. It salts the deploy and signs the deploy authorization — it never pays fees and never controls the wallet — but its determinism is **load-bearing**: overriding `deploySource` changes every derived address and breaks keyId → wallet discovery.
|
|
491
492
|
- The WASM hash is deliberately **not** in the preimage, so an `upgrade` never moves a wallet's address.
|
|
492
493
|
|
|
493
494
|
This tuple is normative and must never change. See [`docs/deployments-testnet-2026-07-11.md`](./docs/deployments-testnet-2026-07-11.md) for the canonical WASM hashes, the deployer `G…` address, and the full derivation spec (including the deploy-front-running consequence in [Caveats](#caveats)).
|
package/dist/constants.d.ts
CHANGED
|
@@ -37,12 +37,23 @@ export declare const WEBAUTHN_CHALLENGE_SIZE = 32;
|
|
|
37
37
|
* `deployer = this keypair`), which is exactly what the indexer reverse-lookup
|
|
38
38
|
* (keyId → contract) depends on.
|
|
39
39
|
*
|
|
40
|
-
* This value MUST remain `"kalepail"`:
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
40
|
+
* This value MUST remain `"kalepail"`: it is the current deterministic deployer,
|
|
41
|
+
* and the derivation is load-bearing for keyId → contract discovery. (Wallets
|
|
42
|
+
* deployed BEFORE commit 23597d8 used an earlier scheme — the deployer was
|
|
43
|
+
* derived from `sha256(networkPassphrase)` — so those wallets live under
|
|
44
|
+
* different, legacy deployer addresses; see the deployer inventory in
|
|
45
|
+
* docs/security-deterministic-deployer.md. It is NOT true that every wallet ever
|
|
46
|
+
* used this seed.) The deployer salts and signs deploy authorization entries — it
|
|
47
|
+
* never controls the wallet and is never the default transaction source. Provide
|
|
48
|
+
* your own `deploySource` only to change the derivation identity (note: doing so
|
|
45
49
|
* changes the derived contract addresses and breaks keyId → contract discovery).
|
|
50
|
+
*
|
|
51
|
+
* ⚠️ SECURITY: the seed is a published constant, so the SECRET key is publicly
|
|
52
|
+
* derivable and the account is SHARED across default-configured integrators.
|
|
53
|
+
* The relayer/channel supplies deploy sequence and fees; footprint restores use
|
|
54
|
+
* the separate `restoreSource`. The shared account's balance and sequence are
|
|
55
|
+
* therefore irrelevant to SDK deploys.
|
|
56
|
+
* See docs/security-deterministic-deployer.md.
|
|
46
57
|
*/
|
|
47
58
|
export declare const DEFAULT_DEPLOYER_SEED = "kalepail";
|
|
48
59
|
/**
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,sEAAsE;AACtE,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,iEAAiE;AACjE,eAAO,MAAM,0BAA0B,IAAO,CAAC;AAE/C,+CAA+C;AAC/C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAEjC,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,QAEjC,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,WAAW,QAEvB,CAAC;AAMF,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAM1C
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"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AAO,MAAM,aAAa,kCAAkC,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -46,12 +46,23 @@ export const WEBAUTHN_CHALLENGE_SIZE = 32;
|
|
|
46
46
|
* `deployer = this keypair`), which is exactly what the indexer reverse-lookup
|
|
47
47
|
* (keyId → contract) depends on.
|
|
48
48
|
*
|
|
49
|
-
* This value MUST remain `"kalepail"`:
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
49
|
+
* This value MUST remain `"kalepail"`: it is the current deterministic deployer,
|
|
50
|
+
* and the derivation is load-bearing for keyId → contract discovery. (Wallets
|
|
51
|
+
* deployed BEFORE commit 23597d8 used an earlier scheme — the deployer was
|
|
52
|
+
* derived from `sha256(networkPassphrase)` — so those wallets live under
|
|
53
|
+
* different, legacy deployer addresses; see the deployer inventory in
|
|
54
|
+
* docs/security-deterministic-deployer.md. It is NOT true that every wallet ever
|
|
55
|
+
* used this seed.) The deployer salts and signs deploy authorization entries — it
|
|
56
|
+
* never controls the wallet and is never the default transaction source. Provide
|
|
57
|
+
* your own `deploySource` only to change the derivation identity (note: doing so
|
|
54
58
|
* changes the derived contract addresses and breaks keyId → contract discovery).
|
|
59
|
+
*
|
|
60
|
+
* ⚠️ SECURITY: the seed is a published constant, so the SECRET key is publicly
|
|
61
|
+
* derivable and the account is SHARED across default-configured integrators.
|
|
62
|
+
* The relayer/channel supplies deploy sequence and fees; footprint restores use
|
|
63
|
+
* the separate `restoreSource`. The shared account's balance and sequence are
|
|
64
|
+
* therefore irrelevant to SDK deploys.
|
|
65
|
+
* See docs/security-deterministic-deployer.md.
|
|
55
66
|
*/
|
|
56
67
|
export const DEFAULT_DEPLOYER_SEED = "kalepail";
|
|
57
68
|
// ============================================================================
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,+EA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B,EAAE,MAAM,GACxB,cAAc,GAAG,IAAI;IAMxB;;;;OAIG;YACW,GAAG;IAqCX,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA8BzD;;;;;;OAMG;YACW,WAAW;IASnB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAapD;;;;;;;;;;OAUG;YACW,iBAAiB;IA6CzB,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;CAiBvC"}
|
package/dist/indexer/mercury.js
CHANGED
|
@@ -164,15 +164,23 @@ export class MercuryIndexer {
|
|
|
164
164
|
}
|
|
165
165
|
const confirmed = [];
|
|
166
166
|
for (const candidate of candidates) {
|
|
167
|
-
if (candidate === derived) {
|
|
168
|
-
confirmed.push(candidate);
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
167
|
if (rpc) {
|
|
168
|
+
// Always prefer the on-chain read, including for the derived address.
|
|
169
|
+
// Matching derivation is not confirmation: `derive(keyId)` is exactly
|
|
170
|
+
// the address an attacker can squat, so accepting it unread would
|
|
171
|
+
// "confirm" the one candidate we have the least reason to trust.
|
|
172
|
+
// This does not defeat a squat running genuine code with the victim
|
|
173
|
+
// installed as a signer — nothing checked here can — it only stops
|
|
174
|
+
// unread rows being handed back as confirmed.
|
|
172
175
|
const signer = await getSigner({ rpc, spec: walletSpec() }, candidate, key);
|
|
173
176
|
if (signer)
|
|
174
177
|
confirmed.push(candidate);
|
|
178
|
+
continue;
|
|
175
179
|
}
|
|
180
|
+
// No rpc: derivation is the only available corroboration (fail-closed
|
|
181
|
+
// above guarantees one of the two exists).
|
|
182
|
+
if (candidate === derived)
|
|
183
|
+
confirmed.push(candidate);
|
|
176
184
|
}
|
|
177
185
|
return confirmed;
|
|
178
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mercury.js","sourceRoot":"","sources":["../../src/indexer/mercury.ts"],"names":[],"mappings":"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;QACnC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC"}
|
package/dist/kit/deploy-ops.d.ts
CHANGED
|
@@ -12,13 +12,13 @@ import { Keypair } from "@stellar/stellar-sdk";
|
|
|
12
12
|
import type { AssembledTransaction } from "@stellar/stellar-sdk/contract";
|
|
13
13
|
import { Client as PasskeyClient } from "passkey-kit-sdk";
|
|
14
14
|
/**
|
|
15
|
-
* Resolve the
|
|
15
|
+
* Resolve the address-derivation deployer keypair from an optional secret.
|
|
16
16
|
*
|
|
17
17
|
* With no secret, derives the canonical deterministic deployer from
|
|
18
|
-
* {@link DEFAULT_DEPLOYER_SEED}. The deployer only
|
|
19
|
-
*
|
|
20
|
-
* changes the derived contract addresses (and breaks
|
|
21
|
-
* discovery), so this is documented as an advanced option.
|
|
18
|
+
* {@link DEFAULT_DEPLOYER_SEED}. The default deployer only salts and authorizes
|
|
19
|
+
* deploys; it never controls the wallet or sources the transaction. Supplying a
|
|
20
|
+
* different `deploySource` changes the derived contract addresses (and breaks
|
|
21
|
+
* keyId → contract discovery), so this is documented as an advanced option.
|
|
22
22
|
*
|
|
23
23
|
* @throws {ConfigurationError} If `deploySource` is not a valid secret key.
|
|
24
24
|
*/
|
|
@@ -32,14 +32,16 @@ export declare function deriveWalletAddress(deps: {
|
|
|
32
32
|
* Build the smart-wallet deploy transaction, initializing it with the passkey as
|
|
33
33
|
* the first (unlimited, persistent) Secp256r1 signer via `__constructor`.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* Shared-default deploys use the SDK's address-only build path, so simulation
|
|
36
|
+
* uses the null carrier account instead of reading the deployer's sequence.
|
|
37
|
+
* Custom deployers keep the normal account-source path.
|
|
37
38
|
*/
|
|
38
39
|
export declare function buildDeployTransaction(deps: {
|
|
39
40
|
rpcUrl: string;
|
|
40
41
|
networkPassphrase: string;
|
|
41
42
|
walletWasmHash: string;
|
|
42
43
|
deployerPublicKey: string;
|
|
44
|
+
usingSharedDeployer: boolean;
|
|
43
45
|
timeoutInSeconds: number;
|
|
44
46
|
}, keyId: Buffer, publicKey: Uint8Array): Promise<AssembledTransaction<PasskeyClient>>;
|
|
45
47
|
//# sourceMappingURL=deploy-ops.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-ops.d.ts","sourceRoot":"","sources":["../../src/kit/deploy-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,MAAM,IAAI,aAAa,EAExB,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAY9D;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,EAC9D,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED
|
|
1
|
+
{"version":3,"file":"deploy-ops.d.ts","sourceRoot":"","sources":["../../src/kit/deploy-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,MAAM,IAAI,aAAa,EAExB,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAY9D;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,EAC9D,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,EACD,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAyB9C"}
|
package/dist/kit/deploy-ops.js
CHANGED
|
@@ -14,13 +14,13 @@ import { DEFAULT_DEPLOYER_SEED } from "../constants.js";
|
|
|
14
14
|
import { deriveContractAddress } from "../utils.js";
|
|
15
15
|
import { ConfigurationError, PasskeyKitErrorCode } from "../errors.js";
|
|
16
16
|
/**
|
|
17
|
-
* Resolve the
|
|
17
|
+
* Resolve the address-derivation deployer keypair from an optional secret.
|
|
18
18
|
*
|
|
19
19
|
* With no secret, derives the canonical deterministic deployer from
|
|
20
|
-
* {@link DEFAULT_DEPLOYER_SEED}. The deployer only
|
|
21
|
-
*
|
|
22
|
-
* changes the derived contract addresses (and breaks
|
|
23
|
-
* discovery), so this is documented as an advanced option.
|
|
20
|
+
* {@link DEFAULT_DEPLOYER_SEED}. The default deployer only salts and authorizes
|
|
21
|
+
* deploys; it never controls the wallet or sources the transaction. Supplying a
|
|
22
|
+
* different `deploySource` changes the derived contract addresses (and breaks
|
|
23
|
+
* keyId → contract discovery), so this is documented as an advanced option.
|
|
24
24
|
*
|
|
25
25
|
* @throws {ConfigurationError} If `deploySource` is not a valid secret key.
|
|
26
26
|
*/
|
|
@@ -43,8 +43,9 @@ export function deriveWalletAddress(deps, keyId) {
|
|
|
43
43
|
* Build the smart-wallet deploy transaction, initializing it with the passkey as
|
|
44
44
|
* the first (unlimited, persistent) Secp256r1 signer via `__constructor`.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* Shared-default deploys use the SDK's address-only build path, so simulation
|
|
47
|
+
* uses the null carrier account instead of reading the deployer's sequence.
|
|
48
|
+
* Custom deployers keep the normal account-source path.
|
|
48
49
|
*/
|
|
49
50
|
export async function buildDeployTransaction(deps, keyId, publicKey) {
|
|
50
51
|
const signer = {
|
|
@@ -61,7 +62,9 @@ export async function buildDeployTransaction(deps, keyId, publicKey) {
|
|
|
61
62
|
rpcUrl: deps.rpcUrl,
|
|
62
63
|
wasmHash: deps.walletWasmHash,
|
|
63
64
|
networkPassphrase: deps.networkPassphrase,
|
|
64
|
-
|
|
65
|
+
...(deps.usingSharedDeployer
|
|
66
|
+
? { address: deps.deployerPublicKey }
|
|
67
|
+
: { publicKey: deps.deployerPublicKey }),
|
|
65
68
|
salt: hash(keyId),
|
|
66
69
|
timeoutInSeconds: deps.timeoutInSeconds,
|
|
67
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-ops.js","sourceRoot":"","sources":["../../src/kit/deploy-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EACL,MAAM,IAAI,aAAa,GAExB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,YAAqB;IACnD,IAAI,YAAY,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,OAAO,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAC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9E,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,mBAAmB,CACjC,IAA8D,EAC9D,KAAa;IAEb,OAAO,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAOC,EACD,KAAa,EACb,SAAqB;IAErB,MAAM,MAAM,GAAc;QACxB,GAAG,EAAE,WAAW;QAChB,MAAM,EAAE;YACN,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;YACtB,CAAC,SAAS,CAAC,EAAE,yBAAyB;YACtC,CAAC,SAAS,CAAC,EAAE,0BAA0B;YACvC,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE;SACzC;KACF,CAAC;IAEF,OAAO,aAAa,CAAC,MAAM,CACzB,EAAE,MAAM,EAAE,EACV;QACE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,cAAc;QAC7B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,GAAG,CAAC,IAAI,CAAC,mBAAmB;YAC1B,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACrC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;QACjB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;KACxC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/kit/tx-ops.d.ts
CHANGED
|
@@ -74,12 +74,12 @@ export interface RestorePreamble {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Restore an archived contract-data footprint reported by simulation, paying
|
|
77
|
-
* with the
|
|
77
|
+
* with the independently configured restore source.
|
|
78
78
|
*
|
|
79
79
|
* Soroban simulation returns a `restorePreamble` when the transaction touches
|
|
80
80
|
* archived entries; the footprint must be restored (a separate, fee-bearing
|
|
81
|
-
* transaction) before the real transaction can succeed.
|
|
82
|
-
*
|
|
81
|
+
* transaction) before the real transaction can succeed. This source is
|
|
82
|
+
* deliberately separate from the address-derivation deployer identity.
|
|
83
83
|
*
|
|
84
84
|
* Returns the restore transaction hash. This path is exercised live in F2 (it
|
|
85
85
|
* requires archived on-chain state to trigger).
|
|
@@ -89,7 +89,7 @@ export interface RestorePreamble {
|
|
|
89
89
|
export declare function restoreFootprint(deps: {
|
|
90
90
|
rpc: Server;
|
|
91
91
|
networkPassphrase: string;
|
|
92
|
-
|
|
92
|
+
sourceKeypair?: Keypair;
|
|
93
93
|
timeoutInSeconds: number;
|
|
94
94
|
}, restorePreamble: RestorePreamble): Promise<string>;
|
|
95
95
|
//# sourceMappingURL=tx-ops.d.ts.map
|
package/dist/kit/tx-ops.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx-ops.d.ts","sourceRoot":"","sources":["../../src/kit/tx-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAiC,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EACV,oBAAoB,EACpB,IAAI,IAAI,YAAY,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tx-ops.d.ts","sourceRoot":"","sources":["../../src/kit/tx-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAiC,GAAG,EAAE,MAAM,sBAAsB,CA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AO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAkBlC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE;QAAE,KAAK,IAAI,GAAG,CAAC,sBAAsB,CAAA;KAAE,CAAC;CAC1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE;IACJ,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,EACD,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,MAAM,CAAC,CAiDjB"}
|
package/dist/kit/tx-ops.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { Operation, TransactionBuilder, xdr } from "@stellar/stellar-sdk";
|
|
19
19
|
import { buildSignaturePayload, getAddressCredentials, signatureToScVal, signerKeyToScVal, toAddressBoundCredentials, upsertSignatureEntry, usesAddressBoundPayload, } from "./auth-payload.js";
|
|
20
20
|
import { SigningError, PasskeyKitError, PasskeyKitErrorCode } from "../errors.js";
|
|
21
|
+
import { isDefaultDeployer } from "../utils.js";
|
|
21
22
|
/**
|
|
22
23
|
* Compute a default signature-expiration ledger: the latest ledger plus the
|
|
23
24
|
* timeout window (assuming ~5s ledgers), rounded up.
|
|
@@ -88,12 +89,12 @@ export async function sign(deps, txn, signer, options) {
|
|
|
88
89
|
}
|
|
89
90
|
/**
|
|
90
91
|
* Restore an archived contract-data footprint reported by simulation, paying
|
|
91
|
-
* with the
|
|
92
|
+
* with the independently configured restore source.
|
|
92
93
|
*
|
|
93
94
|
* Soroban simulation returns a `restorePreamble` when the transaction touches
|
|
94
95
|
* archived entries; the footprint must be restored (a separate, fee-bearing
|
|
95
|
-
* transaction) before the real transaction can succeed.
|
|
96
|
-
*
|
|
96
|
+
* transaction) before the real transaction can succeed. This source is
|
|
97
|
+
* deliberately separate from the address-derivation deployer identity.
|
|
97
98
|
*
|
|
98
99
|
* Returns the restore transaction hash. This path is exercised live in F2 (it
|
|
99
100
|
* requires archived on-chain state to trigger).
|
|
@@ -101,7 +102,15 @@ export async function sign(deps, txn, signer, options) {
|
|
|
101
102
|
* @throws {SigningError} On submission/confirmation failure.
|
|
102
103
|
*/
|
|
103
104
|
export async function restoreFootprint(deps, restorePreamble) {
|
|
104
|
-
|
|
105
|
+
if (!deps.sourceKeypair) {
|
|
106
|
+
throw new PasskeyKitError(`Footprint restoration requires a funded \`restoreSource\` secret. ` +
|
|
107
|
+
`It is intentionally separate from \`deploySource\`, because changing ` +
|
|
108
|
+
`the deployer changes every derived wallet address.`, PasskeyKitErrorCode.INVALID_CONFIG);
|
|
109
|
+
}
|
|
110
|
+
if (isDefaultDeployer(deps.sourceKeypair.publicKey())) {
|
|
111
|
+
throw new PasskeyKitError("restoreSource must be a separate funded account, not the shared default deployer", PasskeyKitErrorCode.INVALID_CONFIG);
|
|
112
|
+
}
|
|
113
|
+
const account = await deps.rpc.getAccount(deps.sourceKeypair.publicKey());
|
|
105
114
|
const fee = (Number(restorePreamble.minResourceFee) + 100_000).toString();
|
|
106
115
|
const restoreTx = new TransactionBuilder(account, {
|
|
107
116
|
fee,
|
|
@@ -111,7 +120,7 @@ export async function restoreFootprint(deps, restorePreamble) {
|
|
|
111
120
|
.setSorobanData(restorePreamble.transactionData.build())
|
|
112
121
|
.setTimeout(deps.timeoutInSeconds)
|
|
113
122
|
.build();
|
|
114
|
-
restoreTx.sign(deps.
|
|
123
|
+
restoreTx.sign(deps.sourceKeypair);
|
|
115
124
|
const sendResult = await deps.rpc.sendTransaction(restoreTx);
|
|
116
125
|
if (sendResult.status === "ERROR") {
|
|
117
126
|
throw new PasskeyKitError(`Footprint restore submission failed: ${sendResult.errorResult?.toXDR("base64") ?? "unknown"}`, PasskeyKitErrorCode.RESTORE_REQUIRED, { context: { hash: sendResult.hash } });
|
package/dist/kit/tx-ops.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx-ops.js","sourceRoot":"","sources":["../../src/kit/tx-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAQ1E,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tx-ops.js","sourceRoot":"","sources":["../../src/kit/tx-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAQ1E,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAoB;IAC5D,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;IACtD,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;AACzD,CAAC;AAgBD;;;;;;GAMG;AACH,MAAM,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M,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,eAAe,CACvB,6CAA6C,MAAM,CAAC,MAAM,GAAG,EAC7D,mBAAmB,CAAC,gBAAgB,EACpC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,CACvC,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC;AACzB,CAAC"}
|
package/dist/kit.d.ts
CHANGED
|
@@ -31,14 +31,32 @@ export interface PasskeyKitConfig {
|
|
|
31
31
|
networkPassphrase: string;
|
|
32
32
|
/** Smart-wallet WASM hash (hex) used to deploy new wallets. */
|
|
33
33
|
walletWasmHash: string;
|
|
34
|
+
/**
|
|
35
|
+
* Code identities (hex WASM hashes) accepted when connecting to a wallet whose
|
|
36
|
+
* address came from an untrusted source — an indexer lookup or address
|
|
37
|
+
* derivation. Defaults to `[walletWasmHash]`.
|
|
38
|
+
*
|
|
39
|
+
* Binding code identity is what makes a wallet's signer state meaningful: under
|
|
40
|
+
* accepted code, a signer entry can only have been produced by logic that
|
|
41
|
+
* required wallet authorization. Arbitrary code can write whatever signer entry
|
|
42
|
+
* a client expects, so without this check a reverse lookup proves nothing.
|
|
43
|
+
*
|
|
44
|
+
* This is a list rather than a single value because a legitimately upgraded
|
|
45
|
+
* wallet runs different code. Add each accepted hash as you roll upgrades out;
|
|
46
|
+
* a wallet running code that is not listed will not connect from an untrusted
|
|
47
|
+
* path. See `docs/security-deterministic-deployer.md`.
|
|
48
|
+
*/
|
|
49
|
+
acceptedWasmHashes?: string[];
|
|
34
50
|
/** WebAuthn Relying Party id (domain); defaults to the current origin. */
|
|
35
51
|
rpId?: string;
|
|
36
52
|
/**
|
|
37
|
-
* Secret key (`S…`) for the
|
|
38
|
-
*
|
|
39
|
-
* derived wallet addresses.
|
|
53
|
+
* Secret key (`S…`) for the address-derivation deployer. Defaults to the
|
|
54
|
+
* canonical shared sign-only deployer (see {@link resolveDeployer});
|
|
55
|
+
* overriding it changes derived wallet addresses.
|
|
40
56
|
*/
|
|
41
57
|
deploySource?: string;
|
|
58
|
+
/** Funded secret key used only to source footprint-restoration transactions. */
|
|
59
|
+
restoreSource?: string;
|
|
42
60
|
/** Transaction timeout, in seconds (default 30). */
|
|
43
61
|
timeoutInSeconds?: number;
|
|
44
62
|
/** Optional passkey-record storage adapter (see `passkey-kit/storage`). */
|
|
@@ -57,8 +75,16 @@ export interface ConnectOptions {
|
|
|
57
75
|
/** Indexer-backed keyId → contract lookup, used when derivation misses. */
|
|
58
76
|
getContractId?: (keyId: string) => Promise<string | undefined>;
|
|
59
77
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
78
|
+
* Override the code-identity check against {@link PasskeyKitConfig.acceptedWasmHashes}.
|
|
79
|
+
*
|
|
80
|
+
* Defaults to ON whenever the address was resolved from an untrusted source
|
|
81
|
+
* (indexer lookup or derivation) and OFF when it came from trusted local
|
|
82
|
+
* storage, where a legitimately upgraded wallet would otherwise be locked out.
|
|
83
|
+
*
|
|
84
|
+
* Set `true` to check even a storage-resolved address; set `false` to skip the
|
|
85
|
+
* check entirely. Disabling it means a reverse lookup can resolve to a contract
|
|
86
|
+
* that merely claims this credential — only do so if you bind code identity
|
|
87
|
+
* yourself.
|
|
62
88
|
*/
|
|
63
89
|
verifyWasmHash?: boolean;
|
|
64
90
|
}
|
|
@@ -67,6 +93,8 @@ export declare class PasskeyKit {
|
|
|
67
93
|
readonly rpcUrl: string;
|
|
68
94
|
readonly networkPassphrase: string;
|
|
69
95
|
readonly walletWasmHash: string;
|
|
96
|
+
/** Accepted code identities, lowercase hex. Never empty. */
|
|
97
|
+
readonly acceptedWasmHashes: readonly string[];
|
|
70
98
|
readonly rpId?: string;
|
|
71
99
|
/** Lifecycle event emitter (walletCreated, walletConnected, …). */
|
|
72
100
|
readonly events: PasskeyEventEmitter;
|
|
@@ -82,24 +110,26 @@ export declare class PasskeyKit {
|
|
|
82
110
|
constructor(config: PasskeyKitConfig);
|
|
83
111
|
/** The connected wallet's contract id, if any. */
|
|
84
112
|
get contractId(): string | undefined;
|
|
85
|
-
/** The
|
|
113
|
+
/** The address-derivation deployer's `G…` public key. */
|
|
86
114
|
get deployerPublicKey(): string;
|
|
87
115
|
private signerContext;
|
|
88
116
|
/** Run a passkey registration ceremony without deploying a wallet. */
|
|
89
117
|
createKey(appName: string, userName: string, options?: CreateOptions): Promise<CreatedPasskey>;
|
|
90
118
|
/**
|
|
91
119
|
* Register a passkey and deploy a smart wallet initialized with it as the
|
|
92
|
-
* first signer. Returns the
|
|
120
|
+
* first signer. Returns the authorized deploy carrier (submit it via
|
|
93
121
|
* `PasskeyServer`).
|
|
94
122
|
*/
|
|
95
123
|
createWallet(appName: string, userName: string, options?: CreateOptions): Promise<CreateWalletResult>;
|
|
96
124
|
/**
|
|
97
125
|
* Connect an existing wallet from a passkey.
|
|
98
126
|
*
|
|
99
|
-
* Resolves the wallet address by (1)
|
|
100
|
-
*
|
|
127
|
+
* Resolves the wallet address by (1) local storage, (2) an injected indexer
|
|
128
|
+
* lookup, then (3) deterministic derivation from the keyId — and then VERIFIES
|
|
101
129
|
* ownership: the keyId must resolve to a live signer on the wallet (#601 F7).
|
|
102
130
|
* This closes the unverified reverse-lookup hole (#598 F3) at the SDK layer.
|
|
131
|
+
* Derivation is deliberately last: it is only correct for a wallet's first
|
|
132
|
+
* credential and is the one path a squatted contract can hijack.
|
|
103
133
|
*
|
|
104
134
|
* @throws {WalletOwnershipError} If the keyId is not a signer on the wallet.
|
|
105
135
|
*/
|
package/dist/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO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