passkey-kit 0.2.5 → 0.4.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/.github/workflows/release.yml +31 -0
- package/.vscode/settings.json +2 -0
- package/README.md +7 -5
- package/TODO.md +1 -2
- package/cheatsheet +12 -1
- package/package.json +6 -6
- package/packages/passkey-factory-sdk/package.json +3 -3
- package/packages/passkey-factory-sdk/src/index.ts +6 -76
- package/packages/passkey-factory-sdk/types/index.d.ts +1 -70
- package/packages/passkey-kit-sdk/package.json +3 -3
- package/packages/passkey-kit-sdk/src/index.ts +23 -69
- package/packages/passkey-kit-sdk/types/index.d.ts +13 -57
- package/src/kit.ts +123 -231
- package/tsconfig.json +1 -2
- package/types/kit.d.ts +15 -12
- package/types/src/base.d.ts +9 -0
- package/types/src/index.d.ts +3 -0
- package/types/src/kit.d.ts +53 -0
- package/types/tests/index.d.ts +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Contract Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
release_name:
|
|
7
|
+
description: 'Unique release name'
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
|
|
13
|
+
release-contract-webauthn-factory:
|
|
14
|
+
uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main
|
|
15
|
+
with:
|
|
16
|
+
release_name: ${{ github.ref_name }}
|
|
17
|
+
release_description: 'Release of the factory contract'
|
|
18
|
+
relative_path: 'contracts'
|
|
19
|
+
package: 'webauthn-factory'
|
|
20
|
+
secrets:
|
|
21
|
+
release_token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
+
|
|
23
|
+
release-contract-webauthn-secp256r1:
|
|
24
|
+
uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main
|
|
25
|
+
with:
|
|
26
|
+
release_name: ${{ github.ref_name }}
|
|
27
|
+
release_description: 'Release of the secp256r1 contract'
|
|
28
|
+
relative_path: 'contracts'
|
|
29
|
+
package: 'webauthn-secp256r1'
|
|
30
|
+
secrets:
|
|
31
|
+
release_token: ${{ secrets.GITHUB_TOKEN }}
|
package/.vscode/settings.json
CHANGED
package/README.md
CHANGED
|
@@ -13,13 +13,14 @@ On the client:
|
|
|
13
13
|
```ts
|
|
14
14
|
const account = new PasskeyKit({
|
|
15
15
|
rpcUrl: env.RPC_URL,
|
|
16
|
-
networkPassphrase: env.NETWORK_PASSPHRASE
|
|
16
|
+
networkPassphrase: env.NETWORK_PASSPHRASE,
|
|
17
|
+
factoryContractId: env.FACTORY_CONTRACT_ID,
|
|
17
18
|
});
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
On the server:
|
|
21
22
|
```ts
|
|
22
|
-
const account = new
|
|
23
|
+
const account = new PasskeyBase({
|
|
23
24
|
launchtubeUrl: env.LAUNCHTUBE_URL,
|
|
24
25
|
launchtubeJwt: env.LAUNCHTUBE_JWT,
|
|
25
26
|
});
|
|
@@ -37,6 +38,7 @@ For any questions or to showcase your progress please join the `#passkeys` chann
|
|
|
37
38
|
|
|
38
39
|
Passkey kit consists of three primary directories:
|
|
39
40
|
- `./contracts` - Contains the Rust Soroban smart contracts of the smart wallet implementation.
|
|
41
|
+
- `./zephyr` - Contains the [Zephyr](https://www.mercurydata.app/products/zephyr-vm) program for processing smart wallet events.
|
|
40
42
|
- `./src` - Contains the TypeScript files for the actual TS SDK library.
|
|
41
43
|
- `./demo` - Contains a basic demo of the SDK in action.
|
|
42
44
|
|
|
@@ -60,8 +62,8 @@ pnpm i
|
|
|
60
62
|
pnpm run start
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
[!IMPORTANT]
|
|
65
|
+
> [!IMPORTANT]
|
|
64
66
|
> If you fiddle with contracts in `./contracts` you'll need to run the make commands. Just remember to update the `WEBAUTHN_FACTORY` and `WEBAUTHN_WASM` values from the `make deploy` command before running `make init`.
|
|
65
67
|
|
|
66
|
-
[!IMPORTANT]
|
|
67
|
-
> Keep in mind the bindings here in `./packages` have been _heavily_ modified. Be careful when rebuilding and updating. Likely you'll only want to update the `src/index.ts` files in each respective package vs swapping out entire directories.
|
|
68
|
+
> [!IMPORTANT]
|
|
69
|
+
> Keep in mind the bindings here in `./packages` have been _heavily_ modified. Be careful when rebuilding and updating. Likely you'll only want to update the `src/index.ts` files in each respective package vs swapping out entire directories.
|
package/TODO.md
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
- [ ]
|
|
2
|
-
- [ ] Attach some meaningful metadata to signers so you know which one belongs to which domain
|
|
1
|
+
- [ ] Add timestamps to zephyr event data
|
package/cheatsheet
CHANGED
|
@@ -2,4 +2,15 @@
|
|
|
2
2
|
npm publish --workspaces
|
|
3
3
|
|
|
4
4
|
# Install passkey-kit
|
|
5
|
-
pnpm publish --no-git-checks
|
|
5
|
+
pnpm publish --no-git-checks
|
|
6
|
+
|
|
7
|
+
# Mercury commands
|
|
8
|
+
# https://test.mercurydata.app/
|
|
9
|
+
|
|
10
|
+
export MERCURY_JWT=???
|
|
11
|
+
mercury-cli --jwt $MERCURY_JWT --local false --mainnet false deploy
|
|
12
|
+
mercury-cli --jwt $MERCURY_JWT --local false --mainnet false catchup --contracts "CCXIUFR243N7QWKXY44LZO3DVUXHAVBEEJWFGNGNVVB44VJXIYWVGNTR" # don't forget to subscribe to the contract first
|
|
13
|
+
curl -X GET https://api.mercurydata.app/catchups/4
|
|
14
|
+
curl -X POST https://api.mercurydata.app/zephyr/execute -H "Authorization: Bearer $MERCURY_JWT" -H 'Content-Type: application/json' -d '{"mode":{"Function": {"fname": "get_signers_by_address", "arguments": "{\"address\": \"CCXIUFR243N7QWKXY44LZO3DVUXHAVBEEJWFGNGNVVB44VJXIYWVGNTR\"}"}}}'
|
|
15
|
+
curl -X POST https://api.mercurydata.app/zephyr/execute -H "Authorization: Bearer $MERCURY_JWT" -H 'Content-Type: application/json' -d '{"mode":{"Function": {"fname": "get_address_by_signer", "arguments": "{\"id\": [78,127,30,69,248,174,95,168,47,59,161,168,51,120,117,135,112,133,232,92]}"}}}'
|
|
16
|
+
curl -X POST https://api.mercurydata.app/zephyr/execute -H "Authorization: Bearer $MERCURY_JWT" -H 'Content-Type: application/json' -d '{"mode":{"Function": {"fname": "get_events_by_address", "arguments": "{\"address\": \"CCXIUFR243N7QWKXY44LZO3DVUXHAVBEEJWFGNGNVVB44VJXIYWVGNTR\"}"}}}'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A helper library for creating and using passkey accounts on the Stellar blockchain.",
|
|
5
5
|
"author": "Tyler van der Hoeven",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"types": "types/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@simplewebauthn/browser": "^10.0.0",
|
|
12
|
-
"@stellar/stellar-sdk": "12.0
|
|
12
|
+
"@stellar/stellar-sdk": "12.1.0",
|
|
13
13
|
"base64url": "^3.0.1",
|
|
14
|
-
"bigint-conversion": "^2.4.3",
|
|
15
14
|
"buffer": "^6.0.3",
|
|
16
15
|
"cbor-x": "^1.5.9",
|
|
17
|
-
"passkey-factory-sdk": "0.0
|
|
18
|
-
"passkey-kit-sdk": "0.0
|
|
16
|
+
"passkey-factory-sdk": "0.2.0",
|
|
17
|
+
"passkey-kit-sdk": "0.2.0"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
|
-
"
|
|
20
|
+
"@simplewebauthn/types": "^10.0.0",
|
|
21
|
+
"typescript": "^5.5.3"
|
|
22
22
|
},
|
|
23
23
|
"workspaces": [
|
|
24
24
|
"packages/*"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0
|
|
2
|
+
"version": "0.2.0",
|
|
3
3
|
"name": "passkey-factory-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"buffer": "6.0.3",
|
|
13
|
-
"@stellar/stellar-sdk": "12.0
|
|
13
|
+
"@stellar/stellar-sdk": "12.1.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "5.
|
|
16
|
+
"typescript": "5.5.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -15,39 +15,16 @@ if (typeof window !== 'undefined') {
|
|
|
15
15
|
export const networks = {
|
|
16
16
|
testnet: {
|
|
17
17
|
networkPassphrase: "Test SDF Network ; September 2015",
|
|
18
|
-
contractId: "
|
|
18
|
+
contractId: "CBCPNJNIR7I6ZI5AIXTMYI3MCDCSTNUZ57XL75HQWI6Y4ESWUP24HRBG",
|
|
19
19
|
}
|
|
20
20
|
} as const
|
|
21
21
|
|
|
22
22
|
export const Errors = {
|
|
23
|
-
1: { message: "" },
|
|
24
|
-
2: { message: "" }
|
|
25
|
-
3: { message: "" },
|
|
26
|
-
4: { message: "" },
|
|
27
|
-
5: { message: "" }
|
|
23
|
+
1: { message: "NotInitialized" },
|
|
24
|
+
2: { message: "AlreadyInitialized" }
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
export interface Client {
|
|
31
|
-
/**
|
|
32
|
-
* Construct and simulate a extend_ttl 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.
|
|
33
|
-
*/
|
|
34
|
-
extend_ttl: (options?: {
|
|
35
|
-
/**
|
|
36
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
37
|
-
*/
|
|
38
|
-
fee?: number;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
42
|
-
*/
|
|
43
|
-
timeoutInSeconds?: number;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
47
|
-
*/
|
|
48
|
-
simulate?: boolean;
|
|
49
|
-
}) => Promise<AssembledTransaction<null>>
|
|
50
|
-
|
|
51
28
|
/**
|
|
52
29
|
* Construct and simulate a init 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.
|
|
53
30
|
*/
|
|
@@ -87,65 +64,18 @@ export interface Client {
|
|
|
87
64
|
*/
|
|
88
65
|
simulate?: boolean;
|
|
89
66
|
}) => Promise<AssembledTransaction<Result<string>>>
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Construct and simulate a add_sig 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.
|
|
93
|
-
*/
|
|
94
|
-
add_sig: ({ id, contract }: { id: Buffer, contract: string }, options?: {
|
|
95
|
-
/**
|
|
96
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
97
|
-
*/
|
|
98
|
-
fee?: number;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
102
|
-
*/
|
|
103
|
-
timeoutInSeconds?: number;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
107
|
-
*/
|
|
108
|
-
simulate?: boolean;
|
|
109
|
-
}) => Promise<AssembledTransaction<Result<void>>>
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Construct and simulate a rm_sig 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.
|
|
113
|
-
*/
|
|
114
|
-
rm_sig: ({ id, contract }: { id: Buffer, contract: string }, options?: {
|
|
115
|
-
/**
|
|
116
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
117
|
-
*/
|
|
118
|
-
fee?: number;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
122
|
-
*/
|
|
123
|
-
timeoutInSeconds?: number;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
127
|
-
*/
|
|
128
|
-
simulate?: boolean;
|
|
129
|
-
}) => Promise<AssembledTransaction<Result<void>>>
|
|
130
|
-
|
|
131
67
|
}
|
|
132
68
|
export class Client extends ContractClient {
|
|
133
69
|
constructor(public readonly options: ContractClientOptions) {
|
|
134
70
|
super(
|
|
135
|
-
new ContractSpec(["
|
|
136
|
-
"AAAAAAAAAAAAAAAKZXh0ZW5kX3R0bAAAAAAAAAAAAAA=",
|
|
71
|
+
new ContractSpec(["AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAAgAAAAAAAAAOTm90SW5pdGlhbGl6ZWQAAAAAAAEAAAAAAAAAEkFscmVhZHlJbml0aWFsaXplZAAAAAAAAg==",
|
|
137
72
|
"AAAAAAAAAAAAAAAEaW5pdAAAAAEAAAAAAAAACXdhc21faGFzaAAAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
138
|
-
"AAAAAAAAAAAAAAAGZGVwbG95AAAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAACcGsAAAAAA+4AAABBAAAAAQAAA+kAAAATAAAAAw==",
|
|
139
|
-
"AAAAAAAAAAAAAAAHYWRkX3NpZwAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAAIY29udHJhY3QAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
140
|
-
"AAAAAAAAAAAAAAAGcm1fc2lnAAAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAAIY29udHJhY3QAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM="]),
|
|
73
|
+
"AAAAAAAAAAAAAAAGZGVwbG95AAAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAACcGsAAAAAA+4AAABBAAAAAQAAA+kAAAATAAAAAw=="]),
|
|
141
74
|
options
|
|
142
75
|
)
|
|
143
76
|
}
|
|
144
77
|
public readonly fromJSON = {
|
|
145
|
-
extend_ttl: this.txFromJSON<null>,
|
|
146
78
|
init: this.txFromJSON<Result<void>>,
|
|
147
|
-
deploy: this.txFromJSON<Result<string
|
|
148
|
-
add_sig: this.txFromJSON<Result<void>>,
|
|
149
|
-
rm_sig: this.txFromJSON<Result<void>>
|
|
79
|
+
deploy: this.txFromJSON<Result<string>>
|
|
150
80
|
}
|
|
151
81
|
}
|
|
@@ -3,7 +3,7 @@ import { AssembledTransaction, Client as ContractClient, ClientOptions as Contra
|
|
|
3
3
|
export declare const networks: {
|
|
4
4
|
readonly testnet: {
|
|
5
5
|
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
6
|
-
readonly contractId: "
|
|
6
|
+
readonly contractId: "CBCPNJNIR7I6ZI5AIXTMYI3MCDCSTNUZ57XL75HQWI6Y4ESWUP24HRBG";
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
export declare const Errors: {
|
|
@@ -13,34 +13,8 @@ export declare const Errors: {
|
|
|
13
13
|
2: {
|
|
14
14
|
message: string;
|
|
15
15
|
};
|
|
16
|
-
3: {
|
|
17
|
-
message: string;
|
|
18
|
-
};
|
|
19
|
-
4: {
|
|
20
|
-
message: string;
|
|
21
|
-
};
|
|
22
|
-
5: {
|
|
23
|
-
message: string;
|
|
24
|
-
};
|
|
25
16
|
};
|
|
26
17
|
export interface Client {
|
|
27
|
-
/**
|
|
28
|
-
* Construct and simulate a extend_ttl 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.
|
|
29
|
-
*/
|
|
30
|
-
extend_ttl: (options?: {
|
|
31
|
-
/**
|
|
32
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
33
|
-
*/
|
|
34
|
-
fee?: number;
|
|
35
|
-
/**
|
|
36
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
37
|
-
*/
|
|
38
|
-
timeoutInSeconds?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
41
|
-
*/
|
|
42
|
-
simulate?: boolean;
|
|
43
|
-
}) => Promise<AssembledTransaction<null>>;
|
|
44
18
|
/**
|
|
45
19
|
* Construct and simulate a init 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.
|
|
46
20
|
*/
|
|
@@ -80,55 +54,12 @@ export interface Client {
|
|
|
80
54
|
*/
|
|
81
55
|
simulate?: boolean;
|
|
82
56
|
}) => Promise<AssembledTransaction<Result<string>>>;
|
|
83
|
-
/**
|
|
84
|
-
* Construct and simulate a add_sig 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.
|
|
85
|
-
*/
|
|
86
|
-
add_sig: ({ id, contract }: {
|
|
87
|
-
id: Buffer;
|
|
88
|
-
contract: string;
|
|
89
|
-
}, options?: {
|
|
90
|
-
/**
|
|
91
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
92
|
-
*/
|
|
93
|
-
fee?: number;
|
|
94
|
-
/**
|
|
95
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
96
|
-
*/
|
|
97
|
-
timeoutInSeconds?: number;
|
|
98
|
-
/**
|
|
99
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
100
|
-
*/
|
|
101
|
-
simulate?: boolean;
|
|
102
|
-
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
103
|
-
/**
|
|
104
|
-
* Construct and simulate a rm_sig 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.
|
|
105
|
-
*/
|
|
106
|
-
rm_sig: ({ id, contract }: {
|
|
107
|
-
id: Buffer;
|
|
108
|
-
contract: string;
|
|
109
|
-
}, options?: {
|
|
110
|
-
/**
|
|
111
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
112
|
-
*/
|
|
113
|
-
fee?: number;
|
|
114
|
-
/**
|
|
115
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
116
|
-
*/
|
|
117
|
-
timeoutInSeconds?: number;
|
|
118
|
-
/**
|
|
119
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
120
|
-
*/
|
|
121
|
-
simulate?: boolean;
|
|
122
|
-
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
123
57
|
}
|
|
124
58
|
export declare class Client extends ContractClient {
|
|
125
59
|
readonly options: ContractClientOptions;
|
|
126
60
|
constructor(options: ContractClientOptions);
|
|
127
61
|
readonly fromJSON: {
|
|
128
|
-
extend_ttl: (json: string) => AssembledTransaction<null>;
|
|
129
62
|
init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
130
63
|
deploy: (json: string) => AssembledTransaction<Result<string, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
131
|
-
add_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
132
|
-
rm_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
133
64
|
};
|
|
134
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0
|
|
2
|
+
"version": "0.2.0",
|
|
3
3
|
"name": "passkey-kit-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"buffer": "6.0.3",
|
|
13
|
-
"@stellar/stellar-sdk": "12.0
|
|
13
|
+
"@stellar/stellar-sdk": "12.1.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "5.
|
|
16
|
+
"typescript": "5.5.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -15,21 +15,19 @@ if (typeof window !== 'undefined') {
|
|
|
15
15
|
export const networks = {
|
|
16
16
|
testnet: {
|
|
17
17
|
networkPassphrase: "Test SDF Network ; September 2015",
|
|
18
|
-
contractId: "
|
|
18
|
+
contractId: "CBCPNJNIR7I6ZI5AIXTMYI3MCDCSTNUZ57XL75HQWI6Y4ESWUP24HRBG",
|
|
19
19
|
}
|
|
20
20
|
} as const
|
|
21
21
|
|
|
22
22
|
export const Errors = {
|
|
23
|
-
1: { message: "" },
|
|
24
|
-
2: { message: "" },
|
|
25
|
-
3: { message: "" },
|
|
26
|
-
4: { message: "" },
|
|
27
|
-
5: { message: "" },
|
|
28
|
-
6: { message: "" },
|
|
29
|
-
7: { message: "" },
|
|
30
|
-
8: { message: "" }
|
|
31
|
-
9: { message: "" },
|
|
32
|
-
10: { message: "" }
|
|
23
|
+
1: { message: "NotFound" },
|
|
24
|
+
2: { message: "NotPermitted" },
|
|
25
|
+
3: { message: "AlreadyInitialized" },
|
|
26
|
+
4: { message: "ClientDataJsonChallengeIncorrect" },
|
|
27
|
+
5: { message: "Secp256r1PublicKeyParse" },
|
|
28
|
+
6: { message: "Secp256r1SignatureParse" },
|
|
29
|
+
7: { message: "Secp256r1VerifyFailed" },
|
|
30
|
+
8: { message: "JsonParseError" }
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
export interface Signature {
|
|
@@ -40,30 +38,10 @@ export interface Signature {
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
export interface Client {
|
|
43
|
-
/**
|
|
44
|
-
* Construct and simulate a extend_ttl 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.
|
|
45
|
-
*/
|
|
46
|
-
extend_ttl: (options?: {
|
|
47
|
-
/**
|
|
48
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
49
|
-
*/
|
|
50
|
-
fee?: number;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
54
|
-
*/
|
|
55
|
-
timeoutInSeconds?: number;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
59
|
-
*/
|
|
60
|
-
simulate?: boolean;
|
|
61
|
-
}) => Promise<AssembledTransaction<null>>
|
|
62
|
-
|
|
63
41
|
/**
|
|
64
42
|
* Construct and simulate a init 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.
|
|
65
43
|
*/
|
|
66
|
-
init: ({ id, pk
|
|
44
|
+
init: ({ id, pk }: { id: Buffer, pk: Buffer }, options?: {
|
|
67
45
|
/**
|
|
68
46
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
69
47
|
*/
|
|
@@ -81,9 +59,9 @@ export interface Client {
|
|
|
81
59
|
}) => Promise<AssembledTransaction<Result<void>>>
|
|
82
60
|
|
|
83
61
|
/**
|
|
84
|
-
* Construct and simulate a
|
|
62
|
+
* Construct and simulate a add 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.
|
|
85
63
|
*/
|
|
86
|
-
|
|
64
|
+
add: ({ id, pk, admin }: { id: Buffer, pk: Buffer, admin: boolean }, options?: {
|
|
87
65
|
/**
|
|
88
66
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
89
67
|
*/
|
|
@@ -101,9 +79,9 @@ export interface Client {
|
|
|
101
79
|
}) => Promise<AssembledTransaction<Result<void>>>
|
|
102
80
|
|
|
103
81
|
/**
|
|
104
|
-
* Construct and simulate a
|
|
82
|
+
* Construct and simulate a remove 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.
|
|
105
83
|
*/
|
|
106
|
-
|
|
84
|
+
remove: ({ id }: { id: Buffer }, options?: {
|
|
107
85
|
/**
|
|
108
86
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
109
87
|
*/
|
|
@@ -121,29 +99,9 @@ export interface Client {
|
|
|
121
99
|
}) => Promise<AssembledTransaction<Result<void>>>
|
|
122
100
|
|
|
123
101
|
/**
|
|
124
|
-
* Construct and simulate a
|
|
125
|
-
*/
|
|
126
|
-
rm_sig: ({ id }: { id: Buffer }, options?: {
|
|
127
|
-
/**
|
|
128
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
129
|
-
*/
|
|
130
|
-
fee?: number;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
134
|
-
*/
|
|
135
|
-
timeoutInSeconds?: number;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
139
|
-
*/
|
|
140
|
-
simulate?: boolean;
|
|
141
|
-
}) => Promise<AssembledTransaction<Result<void>>>
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Construct and simulate a add_sig 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.
|
|
102
|
+
* Construct and simulate a upgrade 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.
|
|
145
103
|
*/
|
|
146
|
-
|
|
104
|
+
upgrade: ({ hash }: { hash: Buffer }, options?: {
|
|
147
105
|
/**
|
|
148
106
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
149
107
|
*/
|
|
@@ -163,24 +121,20 @@ export interface Client {
|
|
|
163
121
|
export class Client extends ContractClient {
|
|
164
122
|
constructor(public readonly options: ContractClientOptions) {
|
|
165
123
|
super(
|
|
166
|
-
new ContractSpec(["
|
|
167
|
-
"
|
|
168
|
-
"
|
|
124
|
+
new ContractSpec(["AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAACAAAAAAAAAAITm90Rm91bmQAAAABAAAAAAAAAAxOb3RQZXJtaXR0ZWQAAAACAAAAAAAAABJBbHJlYWR5SW5pdGlhbGl6ZWQAAAAAAAMAAAAAAAAAIENsaWVudERhdGFKc29uQ2hhbGxlbmdlSW5jb3JyZWN0AAAABAAAAAAAAAAXU2VjcDI1NnIxUHVibGljS2V5UGFyc2UAAAAABQAAAAAAAAAXU2VjcDI1NnIxU2lnbmF0dXJlUGFyc2UAAAAABgAAAAAAAAAVU2VjcDI1NnIxVmVyaWZ5RmFpbGVkAAAAAAAABwAAAAAAAAAOSnNvblBhcnNlRXJyb3IAAAAAAAg=",
|
|
125
|
+
"AAAAAAAAAAAAAAAEaW5pdAAAAAIAAAAAAAAAAmlkAAAAAAAOAAAAAAAAAAJwawAAAAAD7gAAAEEAAAABAAAD6QAAA+0AAAAAAAAAAw==",
|
|
126
|
+
"AAAAAAAAAAAAAAADYWRkAAAAAAMAAAAAAAAAAmlkAAAAAAAOAAAAAAAAAAJwawAAAAAD7gAAAEEAAAAAAAAABWFkbWluAAAAAAAAAQAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
127
|
+
"AAAAAAAAAAAAAAAGcmVtb3ZlAAAAAAABAAAAAAAAAAJpZAAAAAAADgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
169
128
|
"AAAAAAAAAAAAAAAHdXBncmFkZQAAAAABAAAAAAAAAARoYXNoAAAD7gAAACAAAAABAAAD6QAAA+0AAAAAAAAAAw==",
|
|
170
|
-
"AAAAAAAAAAAAAAAGcmVzdWRvAAAAAAABAAAAAAAAAAJpZAAAAAAADgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
171
|
-
"AAAAAAAAAAAAAAAGcm1fc2lnAAAAAAABAAAAAAAAAAJpZAAAAAAADgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
172
|
-
"AAAAAAAAAAAAAAAHYWRkX3NpZwAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAACcGsAAAAAA+4AAABBAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
173
129
|
"AAAAAQAAAAAAAAAAAAAACVNpZ25hdHVyZQAAAAAAAAQAAAAAAAAAEmF1dGhlbnRpY2F0b3JfZGF0YQAAAAAADgAAAAAAAAAQY2xpZW50X2RhdGFfanNvbgAAAA4AAAAAAAAAAmlkAAAAAAAOAAAAAAAAAAlzaWduYXR1cmUAAAAAAAPuAAAAQA==",
|
|
174
130
|
"AAAAAAAAAAAAAAAMX19jaGVja19hdXRoAAAAAwAAAAAAAAARc2lnbmF0dXJlX3BheWxvYWQAAAAAAAPuAAAAIAAAAAAAAAAJc2lnbmF0dXJlAAAAAAAH0AAAAAlTaWduYXR1cmUAAAAAAAAAAAAADWF1dGhfY29udGV4dHMAAAAAAAPqAAAH0AAAAAdDb250ZXh0AAAAAAEAAAPpAAAD7QAAAAAAAAAD"]),
|
|
175
131
|
options
|
|
176
132
|
)
|
|
177
133
|
}
|
|
178
134
|
public readonly fromJSON = {
|
|
179
|
-
extend_ttl: this.txFromJSON<null>,
|
|
180
135
|
init: this.txFromJSON<Result<void>>,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
add_sig: this.txFromJSON<Result<void>>,
|
|
136
|
+
add: this.txFromJSON<Result<void>>,
|
|
137
|
+
remove: this.txFromJSON<Result<void>>,
|
|
138
|
+
upgrade: this.txFromJSON<Result<void>>
|
|
185
139
|
}
|
|
186
140
|
}
|
|
@@ -3,7 +3,7 @@ import { AssembledTransaction, Client as ContractClient, ClientOptions as Contra
|
|
|
3
3
|
export declare const networks: {
|
|
4
4
|
readonly testnet: {
|
|
5
5
|
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
6
|
-
readonly contractId: "
|
|
6
|
+
readonly contractId: "CBCPNJNIR7I6ZI5AIXTMYI3MCDCSTNUZ57XL75HQWI6Y4ESWUP24HRBG";
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
export declare const Errors: {
|
|
@@ -31,12 +31,6 @@ export declare const Errors: {
|
|
|
31
31
|
8: {
|
|
32
32
|
message: string;
|
|
33
33
|
};
|
|
34
|
-
9: {
|
|
35
|
-
message: string;
|
|
36
|
-
};
|
|
37
|
-
10: {
|
|
38
|
-
message: string;
|
|
39
|
-
};
|
|
40
34
|
};
|
|
41
35
|
export interface Signature {
|
|
42
36
|
authenticator_data: Buffer;
|
|
@@ -45,30 +39,12 @@ export interface Signature {
|
|
|
45
39
|
signature: Buffer;
|
|
46
40
|
}
|
|
47
41
|
export interface Client {
|
|
48
|
-
/**
|
|
49
|
-
* Construct and simulate a extend_ttl 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.
|
|
50
|
-
*/
|
|
51
|
-
extend_ttl: (options?: {
|
|
52
|
-
/**
|
|
53
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
54
|
-
*/
|
|
55
|
-
fee?: number;
|
|
56
|
-
/**
|
|
57
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
58
|
-
*/
|
|
59
|
-
timeoutInSeconds?: number;
|
|
60
|
-
/**
|
|
61
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
62
|
-
*/
|
|
63
|
-
simulate?: boolean;
|
|
64
|
-
}) => Promise<AssembledTransaction<null>>;
|
|
65
42
|
/**
|
|
66
43
|
* Construct and simulate a init 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.
|
|
67
44
|
*/
|
|
68
|
-
init: ({ id, pk
|
|
45
|
+
init: ({ id, pk }: {
|
|
69
46
|
id: Buffer;
|
|
70
47
|
pk: Buffer;
|
|
71
|
-
factory: string;
|
|
72
48
|
}, options?: {
|
|
73
49
|
/**
|
|
74
50
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -84,29 +60,12 @@ export interface Client {
|
|
|
84
60
|
simulate?: boolean;
|
|
85
61
|
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
86
62
|
/**
|
|
87
|
-
* Construct and simulate a
|
|
63
|
+
* Construct and simulate a add 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.
|
|
88
64
|
*/
|
|
89
|
-
|
|
90
|
-
hash: Buffer;
|
|
91
|
-
}, options?: {
|
|
92
|
-
/**
|
|
93
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
94
|
-
*/
|
|
95
|
-
fee?: number;
|
|
96
|
-
/**
|
|
97
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
98
|
-
*/
|
|
99
|
-
timeoutInSeconds?: number;
|
|
100
|
-
/**
|
|
101
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
102
|
-
*/
|
|
103
|
-
simulate?: boolean;
|
|
104
|
-
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
105
|
-
/**
|
|
106
|
-
* Construct and simulate a resudo 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.
|
|
107
|
-
*/
|
|
108
|
-
resudo: ({ id }: {
|
|
65
|
+
add: ({ id, pk, admin }: {
|
|
109
66
|
id: Buffer;
|
|
67
|
+
pk: Buffer;
|
|
68
|
+
admin: boolean;
|
|
110
69
|
}, options?: {
|
|
111
70
|
/**
|
|
112
71
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -122,9 +81,9 @@ export interface Client {
|
|
|
122
81
|
simulate?: boolean;
|
|
123
82
|
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
124
83
|
/**
|
|
125
|
-
* Construct and simulate a
|
|
84
|
+
* Construct and simulate a remove 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.
|
|
126
85
|
*/
|
|
127
|
-
|
|
86
|
+
remove: ({ id }: {
|
|
128
87
|
id: Buffer;
|
|
129
88
|
}, options?: {
|
|
130
89
|
/**
|
|
@@ -141,11 +100,10 @@ export interface Client {
|
|
|
141
100
|
simulate?: boolean;
|
|
142
101
|
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
143
102
|
/**
|
|
144
|
-
* Construct and simulate a
|
|
103
|
+
* Construct and simulate a upgrade 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.
|
|
145
104
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
pk: Buffer;
|
|
105
|
+
upgrade: ({ hash }: {
|
|
106
|
+
hash: Buffer;
|
|
149
107
|
}, options?: {
|
|
150
108
|
/**
|
|
151
109
|
* The fee to pay for the transaction. Default: BASE_FEE
|
|
@@ -165,11 +123,9 @@ export declare class Client extends ContractClient {
|
|
|
165
123
|
readonly options: ContractClientOptions;
|
|
166
124
|
constructor(options: ContractClientOptions);
|
|
167
125
|
readonly fromJSON: {
|
|
168
|
-
extend_ttl: (json: string) => AssembledTransaction<null>;
|
|
169
126
|
init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
127
|
+
add: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
128
|
+
remove: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
170
129
|
upgrade: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
171
|
-
resudo: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
172
|
-
rm_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
173
|
-
add_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
174
130
|
};
|
|
175
131
|
}
|