passkey-kit 0.10.19 → 0.10.21
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/cheatsheet.txt +1 -1
- package/package.json +5 -5
- package/packages/passkey-kit-sdk/package.json +4 -4
- package/packages/passkey-kit-sdk/src/index.ts +1 -0
- package/packages/passkey-kit-sdk/types/index.d.ts +1 -0
- package/packages/sac-sdk/package.json +4 -4
- package/packages/sac-sdk/src/index.ts +1 -0
- package/packages/sac-sdk/types/index.d.ts +1 -0
- package/src/kit.ts +21 -0
- package/types/kit.d.ts +2 -0
package/cheatsheet.txt
CHANGED
|
@@ -13,6 +13,6 @@ stellar contract deploy --wasm target/wasm32-unknown-unknown/release/sample_poli
|
|
|
13
13
|
|
|
14
14
|
export JWT=???
|
|
15
15
|
mercury-cli --jwt $JWT --local false --mainnet false deploy
|
|
16
|
-
mercury-cli --jwt $JWT --local false --mainnet false catchup --project-name "smart-wallets-next-dima" --contracts
|
|
16
|
+
mercury-cli --jwt $JWT --local false --mainnet false catchup --project-name "smart-wallets-next-dima" --contracts CBFOIYCWRC5LXYMF7VPM4MTBEIIMDJ6TBWYH2PY5U7MW73MINQNN3V7E
|
|
17
17
|
curl -X GET https://api.mercurydata.app/catchups/4
|
|
18
18
|
curl -X POST https://api.mercurydata.app/v2/key -H "Authorization: Bearer $JWT"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.21",
|
|
4
4
|
"description": "A helper library for creating and using smart wallet accounts on the Stellar blockchain.",
|
|
5
5
|
"author": "Tyler van der Hoeven",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"types": "types/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@simplewebauthn/browser": "^13.1.0",
|
|
12
|
-
"@stellar/stellar-sdk": "^13.
|
|
12
|
+
"@stellar/stellar-sdk": "^13.2.0",
|
|
13
13
|
"base64url": "^3.0.1",
|
|
14
14
|
"buffer": "^6.0.3",
|
|
15
|
-
"passkey-kit-sdk": "0.6.
|
|
16
|
-
"sac-sdk": "0.3.
|
|
15
|
+
"passkey-kit-sdk": "0.6.7",
|
|
16
|
+
"sac-sdk": "0.3.7"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@simplewebauthn/types": "^12.0.0",
|
|
20
|
-
"@types/node": "^22.
|
|
20
|
+
"@types/node": "^22.14.0",
|
|
21
21
|
"typescript": "^5.8.2"
|
|
22
22
|
},
|
|
23
23
|
"workspaces": [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.7",
|
|
3
3
|
"name": "passkey-kit-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"build": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"@stellar/stellar-sdk": "^13.2.0",
|
|
13
|
+
"buffer": "^6.0.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "5.8.2"
|
|
16
|
+
"typescript": "^5.8.2"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -136,6 +136,7 @@ export class Client extends ContractClient {
|
|
|
136
136
|
salt?: Buffer | Uint8Array;
|
|
137
137
|
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
138
138
|
format?: "hex" | "base64";
|
|
139
|
+
address?: string;
|
|
139
140
|
}
|
|
140
141
|
): Promise<AssembledTransaction<T>> {
|
|
141
142
|
return ContractClient.deploy({ signer }, options)
|
|
@@ -178,6 +178,7 @@ export declare class Client extends ContractClient {
|
|
|
178
178
|
salt?: Buffer | Uint8Array;
|
|
179
179
|
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
180
180
|
format?: "hex" | "base64";
|
|
181
|
+
address?: string;
|
|
181
182
|
}): Promise<AssembledTransaction<T>>;
|
|
182
183
|
constructor(options: ContractClientOptions);
|
|
183
184
|
readonly fromJSON: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
2
|
+
"version": "0.3.7",
|
|
3
3
|
"name": "sac-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"build": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"@stellar/stellar-sdk": "^13.2.0",
|
|
13
|
+
"buffer": "^6.0.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "5.8.2"
|
|
16
|
+
"typescript": "^5.8.2"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -531,6 +531,7 @@ export class Client extends ContractClient {
|
|
|
531
531
|
salt?: Buffer | Uint8Array;
|
|
532
532
|
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
533
533
|
format?: "hex" | "base64";
|
|
534
|
+
address?: string;
|
|
534
535
|
}
|
|
535
536
|
): Promise<AssembledTransaction<T>> {
|
|
536
537
|
return ContractClient.deploy(null, options)
|
|
@@ -508,6 +508,7 @@ export declare class Client extends ContractClient {
|
|
|
508
508
|
salt?: Buffer | Uint8Array;
|
|
509
509
|
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
510
510
|
format?: "hex" | "base64";
|
|
511
|
+
address?: string;
|
|
511
512
|
}): Promise<AssembledTransaction<T>>;
|
|
512
513
|
constructor(options: ContractClientOptions);
|
|
513
514
|
readonly fromJSON: {
|
package/src/kit.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { PasskeyBase } from './base'
|
|
|
9
9
|
import { AssembledTransaction, basicNodeSigner, DEFAULT_TIMEOUT, type AssembledTransactionOptions, type Tx } from '@stellar/stellar-sdk/minimal/contract'
|
|
10
10
|
import type { Server } from '@stellar/stellar-sdk/minimal/rpc'
|
|
11
11
|
|
|
12
|
+
// TODO default to 30 second timeouts
|
|
13
|
+
|
|
12
14
|
export class PasskeyKit extends PasskeyBase {
|
|
13
15
|
declare rpc: Server
|
|
14
16
|
declare rpcUrl: string
|
|
@@ -16,6 +18,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
16
18
|
private walletKeypair: Keypair
|
|
17
19
|
private walletPublicKey: string
|
|
18
20
|
private walletWasmHash: string
|
|
21
|
+
private timeoutInSeconds: number
|
|
19
22
|
private WebAuthn: {
|
|
20
23
|
startRegistration: typeof startRegistration,
|
|
21
24
|
startAuthentication: typeof startAuthentication
|
|
@@ -29,6 +32,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
29
32
|
rpcUrl: string,
|
|
30
33
|
networkPassphrase: string,
|
|
31
34
|
walletWasmHash: string,
|
|
35
|
+
timeoutInSeconds?: number,
|
|
32
36
|
WebAuthn?: {
|
|
33
37
|
startRegistration: typeof startRegistration,
|
|
34
38
|
startAuthentication: typeof startAuthentication
|
|
@@ -47,6 +51,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
47
51
|
this.walletKeypair = Keypair.fromRawEd25519Seed(hash(Buffer.from('kalepail')));
|
|
48
52
|
this.walletPublicKey = this.walletKeypair.publicKey()
|
|
49
53
|
this.walletWasmHash = walletWasmHash
|
|
54
|
+
this.timeoutInSeconds = options.timeoutInSeconds || DEFAULT_TIMEOUT
|
|
50
55
|
this.WebAuthn = WebAuthn || { startRegistration, startAuthentication }
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -72,6 +77,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
72
77
|
networkPassphrase: this.networkPassphrase,
|
|
73
78
|
publicKey: this.walletPublicKey,
|
|
74
79
|
salt: hash(keyId),
|
|
80
|
+
timeoutInSeconds: this.timeoutInSeconds,
|
|
75
81
|
}
|
|
76
82
|
)
|
|
77
83
|
|
|
@@ -105,6 +111,12 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
105
111
|
residentKey: "preferred",
|
|
106
112
|
userVerification: "preferred",
|
|
107
113
|
} } = settings || {}
|
|
114
|
+
|
|
115
|
+
// TODO discover the contract id before creating the key so we can use it in the key name
|
|
116
|
+
// TODO it's possible for the creation to fail in which case we've created a passkey but it's not onchain.
|
|
117
|
+
// In this case we should save the passkey info and retry uploading it async vs asking the user to create another passkey
|
|
118
|
+
// This does introduce a storage dependency though so it likely needs to be a function with some logic for choosing how to store the passkey data
|
|
119
|
+
|
|
108
120
|
const { id, response } = await this.WebAuthn.startRegistration({
|
|
109
121
|
optionsJSON: {
|
|
110
122
|
challenge: base64url("stellaristhebetterblockchain"),
|
|
@@ -180,6 +192,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
180
192
|
|
|
181
193
|
////
|
|
182
194
|
// TEMP for backwards compatibility for when we seeded wallets from a factory address
|
|
195
|
+
// Consider putting this in the constructor
|
|
183
196
|
if (!contractId && walletPublicKey) {
|
|
184
197
|
contractId = this.encodeContract(walletPublicKey, keyIdBuffer);
|
|
185
198
|
|
|
@@ -457,6 +470,8 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
457
470
|
public remove(signer: SignerKey) {
|
|
458
471
|
return this.wallet!.remove_signer({
|
|
459
472
|
signer_key: this.getSignerKey(signer)
|
|
473
|
+
}, {
|
|
474
|
+
timeoutInSeconds: this.timeoutInSeconds,
|
|
460
475
|
});
|
|
461
476
|
}
|
|
462
477
|
|
|
@@ -475,6 +490,8 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
475
490
|
{ tag: store, values: undefined },
|
|
476
491
|
],
|
|
477
492
|
},
|
|
493
|
+
}, {
|
|
494
|
+
timeoutInSeconds: this.timeoutInSeconds,
|
|
478
495
|
});
|
|
479
496
|
}
|
|
480
497
|
private ed25519(publicKey: string, limits: SignerLimits, store: SignerStore, fn: 'add_signer' | 'update_signer', expiration?: number) {
|
|
@@ -488,6 +505,8 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
488
505
|
{ tag: store, values: undefined },
|
|
489
506
|
],
|
|
490
507
|
},
|
|
508
|
+
}, {
|
|
509
|
+
timeoutInSeconds: this.timeoutInSeconds,
|
|
491
510
|
});
|
|
492
511
|
}
|
|
493
512
|
private policy(policy: string, limits: SignerLimits, store: SignerStore, fn: 'add_signer' | 'update_signer', expiration?: number) {
|
|
@@ -501,6 +520,8 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
501
520
|
{ tag: store, values: undefined },
|
|
502
521
|
],
|
|
503
522
|
},
|
|
523
|
+
}, {
|
|
524
|
+
timeoutInSeconds: this.timeoutInSeconds,
|
|
504
525
|
});
|
|
505
526
|
}
|
|
506
527
|
|
package/types/kit.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
13
13
|
private walletKeypair;
|
|
14
14
|
private walletPublicKey;
|
|
15
15
|
private walletWasmHash;
|
|
16
|
+
private timeoutInSeconds;
|
|
16
17
|
private WebAuthn;
|
|
17
18
|
keyId: string | undefined;
|
|
18
19
|
networkPassphrase: string;
|
|
@@ -21,6 +22,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
21
22
|
rpcUrl: string;
|
|
22
23
|
networkPassphrase: string;
|
|
23
24
|
walletWasmHash: string;
|
|
25
|
+
timeoutInSeconds?: number;
|
|
24
26
|
WebAuthn?: {
|
|
25
27
|
startRegistration: typeof startRegistration;
|
|
26
28
|
startAuthentication: typeof startAuthentication;
|