passkey-kit 0.10.0 → 0.10.2
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/.vscode/settings.json +0 -4
- 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 +6 -5
- package/src/sac.ts +2 -2
- package/src/server.ts +3 -4
- package/types/base.d.ts +2 -2
- package/types/kit.d.ts +7 -6
- package/types/sac.d.ts +2 -2
package/.vscode/settings.json
CHANGED
|
@@ -2,9 +2,5 @@
|
|
|
2
2
|
"rust-analyzer.linkedProjects": [
|
|
3
3
|
"./zephyr/Cargo.toml",
|
|
4
4
|
"./contracts/Cargo.toml",
|
|
5
|
-
"./contracts/example-contract/Cargo.toml",
|
|
6
|
-
"./contracts/sample-policy/Cargo.toml",
|
|
7
|
-
"./contracts/smart-wallet-factory/Cargo.toml",
|
|
8
|
-
"./contracts/smart-wallet/Cargo.toml",
|
|
9
5
|
]
|
|
10
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
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
|
-
"
|
|
17
|
-
"
|
|
15
|
+
"passkey-factory-sdk": "0.6.1",
|
|
16
|
+
"sac-sdk": "0.3.1",
|
|
17
|
+
"passkey-kit-sdk": "0.6.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
|
|
@@ -389,9 +390,9 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
389
390
|
}
|
|
390
391
|
) {
|
|
391
392
|
if (typeof txn === 'string') {
|
|
392
|
-
txn = AssembledTransaction.fromXDR(this.wallet!.options, txn, this.wallet!.spec
|
|
393
|
+
txn = AssembledTransaction.fromXDR(this.wallet!.options, txn, this.wallet!.spec)
|
|
393
394
|
} else if (!(txn instanceof AssembledTransaction)) {
|
|
394
|
-
txn = AssembledTransaction.fromXDR(this.wallet!.options, txn.toXDR(), this.wallet!.spec
|
|
395
|
+
txn = AssembledTransaction.fromXDR(this.wallet!.options, txn.toXDR(), this.wallet!.spec)
|
|
395
396
|
}
|
|
396
397
|
|
|
397
398
|
await txn.signAuthEntries({
|
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
|
}
|
|
@@ -159,8 +160,6 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
159
160
|
txn = txn.toXDR()
|
|
160
161
|
}
|
|
161
162
|
|
|
162
|
-
console.log(txn);
|
|
163
|
-
|
|
164
163
|
data.set('xdr', txn);
|
|
165
164
|
|
|
166
165
|
if (fee)
|
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: {
|