passkey-kit 0.10.1 → 0.10.3
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/package.json +5 -5
- package/packages/passkey-factory-sdk/package.json +2 -2
- package/packages/passkey-kit-sdk/package.json +2 -2
- package/packages/sac-sdk/package.json +2 -2
- package/src/base.ts +3 -3
- package/src/kit.ts +12 -13
- package/src/sac.ts +2 -2
- package/src/server.ts +3 -2
- package/types/base.d.ts +2 -2
- package/types/kit.d.ts +7 -6
- package/types/sac.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
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,12 +9,12 @@
|
|
|
9
9
|
"types": "types/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@simplewebauthn/browser": "^11.0.0",
|
|
12
|
-
"@stellar/stellar-sdk": "13.0.0
|
|
12
|
+
"@stellar/stellar-sdk": "^13.0.0",
|
|
13
13
|
"base64url": "^3.0.1",
|
|
14
14
|
"buffer": "^6.0.3",
|
|
15
|
-
"passkey-factory-sdk": "0.6.
|
|
16
|
-
"passkey-kit-sdk": "0.6.
|
|
17
|
-
"sac-sdk": "0.3.
|
|
15
|
+
"passkey-factory-sdk": "0.6.1",
|
|
16
|
+
"passkey-kit-sdk": "0.6.1",
|
|
17
|
+
"sac-sdk": "0.3.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@simplewebauthn/types": "^11.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.1",
|
|
3
3
|
"name": "passkey-factory-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.0.0
|
|
13
|
+
"@stellar/stellar-sdk": "13.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "5.6.2"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.1",
|
|
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.0.0
|
|
13
|
+
"@stellar/stellar-sdk": "13.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "5.6.2"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
2
|
+
"version": "0.3.1",
|
|
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.0.0
|
|
13
|
+
"@stellar/stellar-sdk": "13.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "5.6.2"
|
package/src/base.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Server } from "@stellar/stellar-sdk/minimal/rpc"
|
|
2
2
|
|
|
3
3
|
// TODO consider adding support for a signAuthEntry method that conforms to the ed25519 signature scheme of this passkey interface
|
|
4
4
|
// once we do that we can clean the code a little with the `xdr.HashIdPreimage.envelopeTypeSorobanAuthorization` stuff
|
|
@@ -7,12 +7,12 @@ import { SorobanRpc } from "@stellar/stellar-sdk/minimal"
|
|
|
7
7
|
|
|
8
8
|
export class PasskeyBase {
|
|
9
9
|
public rpcUrl: string | undefined
|
|
10
|
-
public rpc:
|
|
10
|
+
public rpc: Server | undefined
|
|
11
11
|
|
|
12
12
|
constructor(rpcUrl?: string) {
|
|
13
13
|
if (rpcUrl) {
|
|
14
14
|
this.rpcUrl = rpcUrl
|
|
15
|
-
this.rpc = new
|
|
15
|
+
this.rpc = new Server(rpcUrl)
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
package/src/kit.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Client as FactoryClient } from 'passkey-factory-sdk'
|
|
2
2
|
import { Client as PasskeyClient, type Signature, type SignerKey as SDKSignerKey, type SignerLimits as SDKSignerLimits } from 'passkey-kit-sdk'
|
|
3
|
-
import { StrKey, hash, xdr,
|
|
3
|
+
import { StrKey, hash, xdr, Keypair, Address } from '@stellar/stellar-sdk/minimal'
|
|
4
4
|
import type { AuthenticatorAttestationResponseJSON, AuthenticatorSelectionCriteria } from "@simplewebauthn/types"
|
|
5
5
|
import { startRegistration, startAuthentication } from "@simplewebauthn/browser"
|
|
6
6
|
import { Buffer } from 'buffer'
|
|
7
7
|
import base64url from 'base64url'
|
|
8
8
|
import type { SignerKey, SignerLimits, SignerStore } from './types'
|
|
9
9
|
import { PasskeyBase } from './base'
|
|
10
|
-
import { AssembledTransaction, DEFAULT_TIMEOUT, type Tx
|
|
10
|
+
import { AssembledTransaction, DEFAULT_TIMEOUT, type Tx } from '@stellar/stellar-sdk/minimal/contract'
|
|
11
|
+
import type { Server } from '@stellar/stellar-sdk/minimal/rpc'
|
|
11
12
|
|
|
12
13
|
// TODO Return base64url encoded strings as well as buffers
|
|
13
14
|
|
|
14
15
|
export class PasskeyKit extends PasskeyBase {
|
|
15
|
-
declare public rpc:
|
|
16
|
+
declare public rpc: Server
|
|
16
17
|
declare public rpcUrl: string
|
|
17
18
|
public keyId: string | undefined
|
|
18
19
|
public networkPassphrase: string
|
|
@@ -90,8 +91,11 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
90
91
|
}) {
|
|
91
92
|
const now = new Date()
|
|
92
93
|
const displayName = `${user} — ${now.toLocaleString()}`
|
|
93
|
-
const { rpId, authenticatorSelection
|
|
94
|
-
|
|
94
|
+
const { rpId, authenticatorSelection = {
|
|
95
|
+
residentKey: "preferred",
|
|
96
|
+
userVerification: "discouraged",
|
|
97
|
+
} } = settings || {}
|
|
98
|
+
const { id, response, ...rest } = await this.WebAuthn.startRegistration({
|
|
95
99
|
optionsJSON: {
|
|
96
100
|
challenge: base64url("stellaristhebetterblockchain"),
|
|
97
101
|
rp: {
|
|
@@ -105,8 +109,6 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
105
109
|
},
|
|
106
110
|
authenticatorSelection,
|
|
107
111
|
pubKeyCredParams: [{ alg: -7, type: "public-key" }],
|
|
108
|
-
// attestation: "none",
|
|
109
|
-
// timeout: 120_000,
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
|
|
@@ -133,8 +135,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
133
135
|
optionsJSON: {
|
|
134
136
|
challenge: base64url("stellaristhebetterblockchain"),
|
|
135
137
|
rpId,
|
|
136
|
-
|
|
137
|
-
// timeout: 120_000
|
|
138
|
+
userVerification: "discouraged",
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
|
|
@@ -276,8 +277,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
276
277
|
? {
|
|
277
278
|
challenge: base64url(payload),
|
|
278
279
|
rpId,
|
|
279
|
-
|
|
280
|
-
// timeout: 120_000
|
|
280
|
+
userVerification: "discouraged",
|
|
281
281
|
}
|
|
282
282
|
: {
|
|
283
283
|
challenge: base64url(payload),
|
|
@@ -290,8 +290,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
290
290
|
type: "public-key",
|
|
291
291
|
},
|
|
292
292
|
],
|
|
293
|
-
|
|
294
|
-
// timeout: 120_000
|
|
293
|
+
userVerification: "discouraged",
|
|
295
294
|
}
|
|
296
295
|
});
|
|
297
296
|
|
package/src/sac.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Client as SacClient } from 'sac-sdk'
|
|
2
2
|
import { PasskeyBase } from "./base"
|
|
3
|
-
import type {
|
|
3
|
+
import type { Server } from '@stellar/stellar-sdk/minimal/rpc'
|
|
4
4
|
|
|
5
5
|
export class SACClient extends PasskeyBase {
|
|
6
|
-
declare public rpc:
|
|
6
|
+
declare public rpc: Server
|
|
7
7
|
declare public rpcUrl: string
|
|
8
8
|
public networkPassphrase: string
|
|
9
9
|
|
package/src/server.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { xdr } from "@stellar/stellar-sdk/minimal"
|
|
2
2
|
import { PasskeyBase } from "./base"
|
|
3
3
|
import base64url from "base64url"
|
|
4
4
|
import type { Tx } from "@stellar/stellar-sdk/minimal/contract"
|
|
5
5
|
import type { Signer } from "./types"
|
|
6
6
|
import { AssembledTransaction } from "@stellar/stellar-sdk/minimal/contract"
|
|
7
|
+
import { Durability } from "@stellar/stellar-sdk/minimal/rpc"
|
|
7
8
|
|
|
8
9
|
export class PasskeyServer extends PasskeyBase {
|
|
9
10
|
public launchtubeUrl: string | undefined
|
|
@@ -85,7 +86,7 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
85
86
|
for (const signer of signers) {
|
|
86
87
|
if (signer.storage === 'Temporary') {
|
|
87
88
|
try {
|
|
88
|
-
await this.rpc.getContractData(contractId, xdr.ScVal.scvBytes(base64url.toBuffer(signer.key)),
|
|
89
|
+
await this.rpc.getContractData(contractId, xdr.ScVal.scvBytes(base64url.toBuffer(signer.key)), Durability.Temporary)
|
|
89
90
|
} catch {
|
|
90
91
|
signer.evicted = true
|
|
91
92
|
}
|
package/types/base.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Server } from "@stellar/stellar-sdk/minimal/rpc";
|
|
2
2
|
export declare class PasskeyBase {
|
|
3
3
|
rpcUrl: string | undefined;
|
|
4
|
-
rpc:
|
|
4
|
+
rpc: Server | undefined;
|
|
5
5
|
constructor(rpcUrl?: string);
|
|
6
6
|
}
|
package/types/kit.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Client as FactoryClient } from 'passkey-factory-sdk';
|
|
2
2
|
import { Client as PasskeyClient } from 'passkey-kit-sdk';
|
|
3
|
-
import { xdr,
|
|
3
|
+
import { xdr, Keypair } from '@stellar/stellar-sdk/minimal';
|
|
4
4
|
import type { AuthenticatorSelectionCriteria } from "@simplewebauthn/types";
|
|
5
5
|
import { startRegistration, startAuthentication } from "@simplewebauthn/browser";
|
|
6
6
|
import { Buffer } from 'buffer';
|
|
7
7
|
import type { SignerKey, SignerLimits, SignerStore } from './types';
|
|
8
8
|
import { PasskeyBase } from './base';
|
|
9
9
|
import { AssembledTransaction, type Tx } from '@stellar/stellar-sdk/minimal/contract';
|
|
10
|
+
import type { Server } from '@stellar/stellar-sdk/minimal/rpc';
|
|
10
11
|
export declare class PasskeyKit extends PasskeyBase {
|
|
11
|
-
rpc:
|
|
12
|
+
rpc: Server;
|
|
12
13
|
rpcUrl: string;
|
|
13
14
|
keyId: string | undefined;
|
|
14
15
|
networkPassphrase: string;
|
|
@@ -28,7 +29,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
28
29
|
};
|
|
29
30
|
});
|
|
30
31
|
createWallet(app: string, user: string): Promise<{
|
|
31
|
-
keyId: Buffer
|
|
32
|
+
keyId: Buffer<ArrayBufferLike>;
|
|
32
33
|
keyId_base64: string;
|
|
33
34
|
contractId: string;
|
|
34
35
|
built: Tx;
|
|
@@ -37,16 +38,16 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
37
38
|
rpId?: string;
|
|
38
39
|
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
39
40
|
}): Promise<{
|
|
40
|
-
keyId: Buffer
|
|
41
|
+
keyId: Buffer<ArrayBufferLike>;
|
|
41
42
|
keyId_base64: string;
|
|
42
|
-
publicKey: Buffer
|
|
43
|
+
publicKey: Buffer<ArrayBufferLike>;
|
|
43
44
|
}>;
|
|
44
45
|
connectWallet(opts?: {
|
|
45
46
|
rpId?: string;
|
|
46
47
|
keyId?: string | Uint8Array;
|
|
47
48
|
getContractId?: (keyId: string) => Promise<string | undefined>;
|
|
48
49
|
}): Promise<{
|
|
49
|
-
keyId: Buffer
|
|
50
|
+
keyId: Buffer<ArrayBufferLike>;
|
|
50
51
|
keyId_base64: string;
|
|
51
52
|
contractId: string;
|
|
52
53
|
}>;
|
package/types/sac.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Client as SacClient } from 'sac-sdk';
|
|
2
2
|
import { PasskeyBase } from "./base";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Server } from '@stellar/stellar-sdk/minimal/rpc';
|
|
4
4
|
export declare class SACClient extends PasskeyBase {
|
|
5
|
-
rpc:
|
|
5
|
+
rpc: Server;
|
|
6
6
|
rpcUrl: string;
|
|
7
7
|
networkPassphrase: string;
|
|
8
8
|
constructor(options: {
|