passkey-kit 0.10.6 → 0.10.8
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 +4 -4
- package/packages/passkey-kit-sdk/package.json +2 -2
- package/packages/passkey-kit-sdk/src/index.ts +17 -28
- package/packages/passkey-kit-sdk/types/index.d.ts +13 -9
- package/packages/sac-sdk/package.json +2 -2
- package/packages/sac-sdk/src/index.ts +0 -12
- package/packages/sac-sdk/types/index.d.ts +0 -7
- package/src/kit.ts +23 -14
- package/src/types.ts +1 -1
- package/types/kit.d.ts +4 -4
- package/types/types.d.ts +1 -1
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 CDJWTBQTTGWZVJNS4UC47DIBKEYGDV2YHRAYBD3A2ZLWVXFI6LHYZQPA
|
|
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.8",
|
|
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,11 +9,11 @@
|
|
|
9
9
|
"types": "types/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@simplewebauthn/browser": "^13.0.0",
|
|
12
|
-
"@stellar/stellar-sdk": "^13.
|
|
12
|
+
"@stellar/stellar-sdk": "^13.1.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.4",
|
|
16
|
+
"sac-sdk": "0.3.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@simplewebauthn/types": "^12.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.4",
|
|
3
3
|
"name": "passkey-kit-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"buffer": "6.0.3",
|
|
13
|
-
"@stellar/stellar-sdk": "13.
|
|
13
|
+
"@stellar/stellar-sdk": "13.1.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "5.7.2"
|
|
@@ -18,41 +18,29 @@ if (typeof window !== 'undefined') {
|
|
|
18
18
|
|
|
19
19
|
export const Errors = {
|
|
20
20
|
1: { message: "NotFound" },
|
|
21
|
-
|
|
22
21
|
2: { message: "AlreadyExists" },
|
|
23
|
-
|
|
24
22
|
3: { message: "MissingContext" },
|
|
25
|
-
|
|
26
23
|
4: { message: "SignerExpired" },
|
|
27
|
-
|
|
28
24
|
5: { message: "FailedSignerLimits" },
|
|
29
|
-
|
|
30
25
|
6: { message: "FailedPolicySignerLimits" },
|
|
31
|
-
|
|
32
26
|
7: { message: "SignatureKeyValueMismatch" },
|
|
33
|
-
|
|
34
27
|
8: { message: "ClientDataJsonChallengeIncorrect" },
|
|
35
|
-
|
|
36
28
|
9: { message: "JsonParseError" }
|
|
37
29
|
}
|
|
38
|
-
export type SignerLimits = readonly [Map<string, Option<Array<SignerKey>>>];
|
|
39
|
-
export type SignerKey = { tag: "Policy", values: readonly [string] } | { tag: "Ed25519", values: readonly [Buffer] } | { tag: "Secp256r1", values: readonly [Buffer] };
|
|
40
|
-
|
|
41
|
-
export type SignerVal = { tag: "Policy", values: readonly [Option<u32>, SignerLimits] } | { tag: "Ed25519", values: readonly [Option<u32>, SignerLimits] } | { tag: "Secp256r1", values: readonly [Buffer, Option<u32>, SignerLimits] };
|
|
42
30
|
|
|
31
|
+
export type SignerLimits = readonly [Option<Map<string, Option<Array<SignerKey>>>>];
|
|
32
|
+
export type SignerExpiration = readonly [Option<u32>];
|
|
33
|
+
export type SignerKey = { tag: "Policy", values: readonly [string] } | { tag: "Ed25519", values: readonly [Buffer] } | { tag: "Secp256r1", values: readonly [Buffer] };
|
|
34
|
+
export type SignerVal = { tag: "Policy", values: readonly [SignerExpiration, SignerLimits] } | { tag: "Ed25519", values: readonly [SignerExpiration, SignerLimits] } | { tag: "Secp256r1", values: readonly [Buffer, SignerExpiration, SignerLimits] };
|
|
43
35
|
export type SignerStorage = { tag: "Persistent", values: void } | { tag: "Temporary", values: void };
|
|
44
|
-
|
|
45
|
-
export type Signer = { tag: "Policy", values: readonly [string, Option<u32>, SignerLimits, SignerStorage] } | { tag: "Ed25519", values: readonly [Buffer, Option<u32>, SignerLimits, SignerStorage] } | { tag: "Secp256r1", values: readonly [Buffer, Buffer, Option<u32>, SignerLimits, SignerStorage] };
|
|
46
|
-
|
|
36
|
+
export type Signer = { tag: "Policy", values: readonly [string, SignerExpiration, SignerLimits, SignerStorage] } | { tag: "Ed25519", values: readonly [Buffer, SignerExpiration, SignerLimits, SignerStorage] } | { tag: "Secp256r1", values: readonly [Buffer, Buffer, SignerExpiration, SignerLimits, SignerStorage] };
|
|
47
37
|
export interface Secp256r1Signature {
|
|
48
38
|
authenticator_data: Buffer;
|
|
49
39
|
client_data_json: Buffer;
|
|
50
40
|
signature: Buffer;
|
|
51
41
|
}
|
|
52
|
-
|
|
53
|
-
export type
|
|
54
|
-
|
|
55
|
-
export type Signatures = readonly [Map<SignerKey, Option<Signature>>];
|
|
42
|
+
export type Signature = { tag: "Policy", values: void } | { tag: "Ed25519", values: readonly [Buffer] } | { tag: "Secp256r1", values: readonly [Secp256r1Signature] };
|
|
43
|
+
export type Signatures = readonly [Map<SignerKey, Signature>];
|
|
56
44
|
|
|
57
45
|
export interface Client {
|
|
58
46
|
/**
|
|
@@ -134,12 +122,11 @@ export interface Client {
|
|
|
134
122
|
*/
|
|
135
123
|
simulate?: boolean;
|
|
136
124
|
}) => Promise<AssembledTransaction<null>>
|
|
137
|
-
|
|
138
125
|
}
|
|
139
126
|
export class Client extends ContractClient {
|
|
140
127
|
static async deploy<T = Client>(
|
|
141
128
|
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
142
|
-
{ signer }: { signer:
|
|
129
|
+
{ signer }: { signer: Signer },
|
|
143
130
|
/** Options for initalizing a Client as well as for calling a method, with extras specific to deploying. */
|
|
144
131
|
options: MethodOptions &
|
|
145
132
|
Omit<ContractClientOptions, "contractId"> & {
|
|
@@ -156,20 +143,22 @@ export class Client extends ContractClient {
|
|
|
156
143
|
constructor(public readonly options: ContractClientOptions) {
|
|
157
144
|
super(
|
|
158
145
|
new ContractSpec(["AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAACQAAAAAAAAAITm90Rm91bmQAAAABAAAAAAAAAA1BbHJlYWR5RXhpc3RzAAAAAAAAAgAAAAAAAAAOTWlzc2luZ0NvbnRleHQAAAAAAAMAAAAAAAAADVNpZ25lckV4cGlyZWQAAAAAAAAEAAAAAAAAABJGYWlsZWRTaWduZXJMaW1pdHMAAAAAAAUAAAAAAAAAGEZhaWxlZFBvbGljeVNpZ25lckxpbWl0cwAAAAYAAAAAAAAAGVNpZ25hdHVyZUtleVZhbHVlTWlzbWF0Y2gAAAAAAAAHAAAAAAAAACBDbGllbnREYXRhSnNvbkNoYWxsZW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AAQAAAAAAAAAGc2lnbmVyAAAAAAfQAAAABlNpZ25lcgAAAAAAAA==",
|
|
169
157
|
"AAAAAAAAAAAAAAANdXBkYXRlX3NpZ25lcgAAAAAAAAEAAAAAAAAABnNpZ25lcgAAAAAH0AAAAAZTaWduZXIAAAAAAAA=",
|
|
170
158
|
"AAAAAAAAAAAAAAANcmVtb3ZlX3NpZ25lcgAAAAAAAAEAAAAAAAAACnNpZ25lcl9rZXkAAAAAB9AAAAAJU2lnbmVyS2V5AAAAAAAAAA==",
|
|
171
159
|
"AAAAAAAAAAAAAAAUdXBkYXRlX2NvbnRyYWN0X2NvZGUAAAABAAAAAAAAAARoYXNoAAAD7gAAACAAAAAA",
|
|
172
|
-
"AAAAAAAAAAAAAAAMX19jaGVja19hdXRoAAAAAwAAAAAAAAARc2lnbmF0dXJlX3BheWxvYWQAAAAAAAPuAAAAIAAAAAAAAAAKc2lnbmF0dXJlcwAAAAAH0AAAAApTaWduYXR1cmVzAAAAAAAAAAAADWF1dGhfY29udGV4dHMAAAAAAAPqAAAH0AAAAAdDb250ZXh0AAAAAAEAAAPpAAAD7QAAAAAAAAAD"
|
|
160
|
+
"AAAAAAAAAAAAAAAMX19jaGVja19hdXRoAAAAAwAAAAAAAAARc2lnbmF0dXJlX3BheWxvYWQAAAAAAAPuAAAAIAAAAAAAAAAKc2lnbmF0dXJlcwAAAAAH0AAAAApTaWduYXR1cmVzAAAAAAAAAAAADWF1dGhfY29udGV4dHMAAAAAAAPqAAAH0AAAAAdDb250ZXh0AAAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
161
|
+
"AAAAAQAAAAAAAAAAAAAAEFNpZ25lckV4cGlyYXRpb24AAAABAAAAAAAAAAEwAAAAAAAD6AAAAAQ="]),
|
|
173
162
|
options
|
|
174
163
|
)
|
|
175
164
|
}
|
|
@@ -30,7 +30,8 @@ export declare const Errors: {
|
|
|
30
30
|
message: string;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
export type SignerLimits = readonly [Map<string, Option<Array<SignerKey
|
|
33
|
+
export type SignerLimits = readonly [Option<Map<string, Option<Array<SignerKey>>>>];
|
|
34
|
+
export type SignerExpiration = readonly [Option<u32>];
|
|
34
35
|
export type SignerKey = {
|
|
35
36
|
tag: "Policy";
|
|
36
37
|
values: readonly [string];
|
|
@@ -43,13 +44,13 @@ export type SignerKey = {
|
|
|
43
44
|
};
|
|
44
45
|
export type SignerVal = {
|
|
45
46
|
tag: "Policy";
|
|
46
|
-
values: readonly [
|
|
47
|
+
values: readonly [SignerExpiration, SignerLimits];
|
|
47
48
|
} | {
|
|
48
49
|
tag: "Ed25519";
|
|
49
|
-
values: readonly [
|
|
50
|
+
values: readonly [SignerExpiration, SignerLimits];
|
|
50
51
|
} | {
|
|
51
52
|
tag: "Secp256r1";
|
|
52
|
-
values: readonly [Buffer,
|
|
53
|
+
values: readonly [Buffer, SignerExpiration, SignerLimits];
|
|
53
54
|
};
|
|
54
55
|
export type SignerStorage = {
|
|
55
56
|
tag: "Persistent";
|
|
@@ -60,13 +61,13 @@ export type SignerStorage = {
|
|
|
60
61
|
};
|
|
61
62
|
export type Signer = {
|
|
62
63
|
tag: "Policy";
|
|
63
|
-
values: readonly [string,
|
|
64
|
+
values: readonly [string, SignerExpiration, SignerLimits, SignerStorage];
|
|
64
65
|
} | {
|
|
65
66
|
tag: "Ed25519";
|
|
66
|
-
values: readonly [Buffer,
|
|
67
|
+
values: readonly [Buffer, SignerExpiration, SignerLimits, SignerStorage];
|
|
67
68
|
} | {
|
|
68
69
|
tag: "Secp256r1";
|
|
69
|
-
values: readonly [Buffer, Buffer,
|
|
70
|
+
values: readonly [Buffer, Buffer, SignerExpiration, SignerLimits, SignerStorage];
|
|
70
71
|
};
|
|
71
72
|
export interface Secp256r1Signature {
|
|
72
73
|
authenticator_data: Buffer;
|
|
@@ -74,13 +75,16 @@ export interface Secp256r1Signature {
|
|
|
74
75
|
signature: Buffer;
|
|
75
76
|
}
|
|
76
77
|
export type Signature = {
|
|
78
|
+
tag: "Policy";
|
|
79
|
+
values: void;
|
|
80
|
+
} | {
|
|
77
81
|
tag: "Ed25519";
|
|
78
82
|
values: readonly [Buffer];
|
|
79
83
|
} | {
|
|
80
84
|
tag: "Secp256r1";
|
|
81
85
|
values: readonly [Secp256r1Signature];
|
|
82
86
|
};
|
|
83
|
-
export type Signatures = readonly [Map<SignerKey,
|
|
87
|
+
export type Signatures = readonly [Map<SignerKey, Signature>];
|
|
84
88
|
export interface Client {
|
|
85
89
|
/**
|
|
86
90
|
* Construct and simulate a add_signer transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
@@ -164,7 +168,7 @@ export declare class Client extends ContractClient {
|
|
|
164
168
|
static deploy<T = Client>(
|
|
165
169
|
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
166
170
|
{ signer }: {
|
|
167
|
-
signer:
|
|
171
|
+
signer: Signer;
|
|
168
172
|
},
|
|
169
173
|
/** Options for initalizing a Client as well as for calling a method, with extras specific to deploying. */
|
|
170
174
|
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
2
|
+
"version": "0.3.4",
|
|
3
3
|
"name": "sac-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"buffer": "6.0.3",
|
|
13
|
-
"@stellar/stellar-sdk": "13.
|
|
13
|
+
"@stellar/stellar-sdk": "13.1.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "5.7.2"
|
|
@@ -16,17 +16,6 @@ if (typeof window !== 'undefined') {
|
|
|
16
16
|
window.Buffer = window.Buffer || Buffer;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const networks = {
|
|
20
|
-
testnet: {
|
|
21
|
-
networkPassphrase: "Test SDF Network ; September 2015",
|
|
22
|
-
contractId: "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
|
|
23
|
-
}
|
|
24
|
-
} as const
|
|
25
|
-
|
|
26
|
-
export const Errors = {
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
19
|
export interface Client {
|
|
31
20
|
/**
|
|
32
21
|
* Construct and simulate a allowance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
@@ -530,7 +519,6 @@ export interface Client {
|
|
|
530
519
|
*/
|
|
531
520
|
simulate?: boolean;
|
|
532
521
|
}) => Promise<AssembledTransaction<null>>
|
|
533
|
-
|
|
534
522
|
}
|
|
535
523
|
export class Client extends ContractClient {
|
|
536
524
|
static async deploy<T = Client>(
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
2
|
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/minimal/contract';
|
|
3
3
|
import type { u32, i128 } from '@stellar/stellar-sdk/minimal/contract';
|
|
4
|
-
export declare const networks: {
|
|
5
|
-
readonly testnet: {
|
|
6
|
-
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
7
|
-
readonly contractId: "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC";
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export declare const Errors: {};
|
|
11
4
|
export interface Client {
|
|
12
5
|
/**
|
|
13
6
|
* Construct and simulate a allowance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
package/src/kit.ts
CHANGED
|
@@ -13,14 +13,14 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
13
13
|
declare rpc: Server
|
|
14
14
|
declare rpcUrl: string
|
|
15
15
|
|
|
16
|
-
private walletKeypair
|
|
17
|
-
private walletPublicKey
|
|
16
|
+
private walletKeypair: Keypair
|
|
17
|
+
private walletPublicKey: string
|
|
18
18
|
private walletWasmHash: string
|
|
19
19
|
private WebAuthn: {
|
|
20
20
|
startRegistration: typeof startRegistration,
|
|
21
21
|
startAuthentication: typeof startAuthentication
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
public keyId: string | undefined
|
|
25
25
|
public networkPassphrase: string
|
|
26
26
|
public wallet: PasskeyClient | undefined
|
|
@@ -39,12 +39,14 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
39
39
|
super(rpcUrl)
|
|
40
40
|
|
|
41
41
|
this.networkPassphrase = networkPassphrase
|
|
42
|
+
this.walletKeypair = Keypair.fromRawEd25519Seed(hash(Buffer.from(this.networkPassphrase)))
|
|
43
|
+
this.walletPublicKey = this.walletKeypair.publicKey()
|
|
42
44
|
this.walletWasmHash = walletWasmHash
|
|
43
45
|
this.WebAuthn = WebAuthn || { startRegistration, startAuthentication }
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
public async createWallet(app: string, user: string) {
|
|
47
|
-
const { keyId,
|
|
49
|
+
const { keyId, keyIdBase64, publicKey } = await this.createKey(app, user)
|
|
48
50
|
|
|
49
51
|
const at = await PasskeyClient.deploy(
|
|
50
52
|
{
|
|
@@ -53,8 +55,8 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
53
55
|
values: [
|
|
54
56
|
keyId,
|
|
55
57
|
publicKey,
|
|
56
|
-
undefined,
|
|
57
|
-
[
|
|
58
|
+
[undefined],
|
|
59
|
+
[undefined],
|
|
58
60
|
{ tag: 'Persistent', values: undefined },
|
|
59
61
|
]
|
|
60
62
|
}
|
|
@@ -82,9 +84,9 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
82
84
|
|
|
83
85
|
return {
|
|
84
86
|
keyId,
|
|
85
|
-
|
|
87
|
+
keyIdBase64,
|
|
86
88
|
contractId,
|
|
87
|
-
|
|
89
|
+
signedTx: at.signed!
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -120,7 +122,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
120
122
|
|
|
121
123
|
return {
|
|
122
124
|
keyId: base64url.toBuffer(id),
|
|
123
|
-
|
|
125
|
+
keyIdBase64: id,
|
|
124
126
|
publicKey: await this.getPublicKey(response),
|
|
125
127
|
}
|
|
126
128
|
}
|
|
@@ -189,7 +191,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
189
191
|
|
|
190
192
|
return {
|
|
191
193
|
keyId: keyIdBuffer,
|
|
192
|
-
|
|
194
|
+
keyIdBase64: keyId,
|
|
193
195
|
contractId
|
|
194
196
|
}
|
|
195
197
|
}
|
|
@@ -256,6 +258,10 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
256
258
|
tag: "Policy",
|
|
257
259
|
values: [policy]
|
|
258
260
|
}
|
|
261
|
+
val = {
|
|
262
|
+
tag: "Policy",
|
|
263
|
+
values: undefined,
|
|
264
|
+
}
|
|
259
265
|
}
|
|
260
266
|
|
|
261
267
|
// Sign with the keypair as an ed25519 signer
|
|
@@ -443,7 +449,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
443
449
|
values: [
|
|
444
450
|
Buffer.from(keyId),
|
|
445
451
|
Buffer.from(publicKey),
|
|
446
|
-
expiration,
|
|
452
|
+
[expiration],
|
|
447
453
|
this.getSignerLimits(limits),
|
|
448
454
|
{ tag: store, values: undefined },
|
|
449
455
|
],
|
|
@@ -456,7 +462,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
456
462
|
tag: "Ed25519",
|
|
457
463
|
values: [
|
|
458
464
|
Keypair.fromPublicKey(publicKey).rawPublicKey(),
|
|
459
|
-
expiration,
|
|
465
|
+
[expiration],
|
|
460
466
|
this.getSignerLimits(limits),
|
|
461
467
|
{ tag: store, values: undefined },
|
|
462
468
|
],
|
|
@@ -469,7 +475,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
469
475
|
tag: "Policy",
|
|
470
476
|
values: [
|
|
471
477
|
policy,
|
|
472
|
-
expiration,
|
|
478
|
+
[expiration],
|
|
473
479
|
this.getSignerLimits(limits),
|
|
474
480
|
{ tag: store, values: undefined },
|
|
475
481
|
],
|
|
@@ -483,6 +489,9 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
483
489
|
*/
|
|
484
490
|
|
|
485
491
|
private getSignerLimits(limits: SignerLimits) {
|
|
492
|
+
if (!limits)
|
|
493
|
+
return [undefined] as SDKSignerLimits
|
|
494
|
+
|
|
486
495
|
const sdk_limits: SDKSignerLimits = [new Map()]
|
|
487
496
|
|
|
488
497
|
for (const [contract, signer_keys] of limits.entries()) {
|
|
@@ -498,7 +507,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
498
507
|
}
|
|
499
508
|
}
|
|
500
509
|
|
|
501
|
-
sdk_limits[0]
|
|
510
|
+
sdk_limits[0]?.set(contract, sdk_signer_keys)
|
|
502
511
|
}
|
|
503
512
|
|
|
504
513
|
return sdk_limits
|
package/src/types.ts
CHANGED
package/types/kit.d.ts
CHANGED
|
@@ -28,16 +28,16 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
28
28
|
});
|
|
29
29
|
createWallet(app: string, user: string): Promise<{
|
|
30
30
|
keyId: Buffer<ArrayBufferLike>;
|
|
31
|
-
|
|
31
|
+
keyIdBase64: string;
|
|
32
32
|
contractId: string;
|
|
33
|
-
|
|
33
|
+
signedTx: Tx;
|
|
34
34
|
}>;
|
|
35
35
|
createKey(app: string, user: string, settings?: {
|
|
36
36
|
rpId?: string;
|
|
37
37
|
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
38
38
|
}): Promise<{
|
|
39
39
|
keyId: Buffer<ArrayBufferLike>;
|
|
40
|
-
|
|
40
|
+
keyIdBase64: string;
|
|
41
41
|
publicKey: Buffer<ArrayBufferLike>;
|
|
42
42
|
}>;
|
|
43
43
|
connectWallet(opts?: {
|
|
@@ -46,7 +46,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
46
46
|
getContractId?: (keyId: string) => Promise<string | undefined>;
|
|
47
47
|
}): Promise<{
|
|
48
48
|
keyId: Buffer<ArrayBufferLike>;
|
|
49
|
-
|
|
49
|
+
keyIdBase64: string;
|
|
50
50
|
contractId: string;
|
|
51
51
|
}>;
|
|
52
52
|
signAuthEntry(entry: xdr.SorobanAuthorizationEntry, options?: {
|
package/types/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class SignerKey {
|
|
|
15
15
|
static Ed25519(publicKey: string): SignerKey;
|
|
16
16
|
static Secp256r1(id: string): SignerKey;
|
|
17
17
|
}
|
|
18
|
-
export type SignerLimits = Map<string, SignerKey[] | undefined
|
|
18
|
+
export type SignerLimits = Map<string, SignerKey[] | undefined> | undefined;
|
|
19
19
|
export declare enum SignerStore {
|
|
20
20
|
Persistent = "Persistent",
|
|
21
21
|
Temporary = "Temporary"
|