passkey-kit 0.10.17 → 0.10.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passkey-kit",
3
- "version": "0.10.17",
3
+ "version": "0.10.19",
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",
@@ -12,12 +12,12 @@
12
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.5",
16
- "sac-sdk": "0.3.5"
15
+ "passkey-kit-sdk": "0.6.6",
16
+ "sac-sdk": "0.3.6"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@simplewebauthn/types": "^12.0.0",
20
- "@types/node": "^22.13.6",
20
+ "@types/node": "^22.13.10",
21
21
  "typescript": "^5.8.2"
22
22
  },
23
23
  "workspaces": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.5",
2
+ "version": "0.6.6",
3
3
  "name": "passkey-kit-sdk",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
@@ -13,6 +13,6 @@
13
13
  "@stellar/stellar-sdk": "13.1.0"
14
14
  },
15
15
  "devDependencies": {
16
- "typescript": "5.7.2"
16
+ "typescript": "5.8.2"
17
17
  }
18
18
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.5",
2
+ "version": "0.3.6",
3
3
  "name": "sac-sdk",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
@@ -13,6 +13,6 @@
13
13
  "@stellar/stellar-sdk": "13.1.0"
14
14
  },
15
15
  "devDependencies": {
16
- "typescript": "5.7.2"
16
+ "typescript": "5.8.2"
17
17
  }
18
18
  }
package/src/kit.ts CHANGED
@@ -136,7 +136,9 @@ export class PasskeyKit extends PasskeyBase {
136
136
  rpId?: string,
137
137
  keyId?: string | Uint8Array,
138
138
  getContractId?: (keyId: string) => Promise<string | undefined>,
139
- walletPublicKey?: string // TEMP for backwards compatibility for when we seeded wallets from a factory address
139
+ // TEMP for backwards compatibility for when we seeded wallets from a factory address
140
+ // Consider putting this somewhere else??
141
+ walletPublicKey?: string
140
142
  }) {
141
143
  let { keyId, rpId, getContractId, walletPublicKey } = opts || {}
142
144
  let keyIdBuffer: Buffer
package/src/server.ts CHANGED
@@ -7,12 +7,15 @@ import { AssembledTransaction } from "@stellar/stellar-sdk/minimal/contract"
7
7
  import { Durability } from "@stellar/stellar-sdk/minimal/rpc"
8
8
  import { version } from '../package.json'
9
9
 
10
+ // TODO set default headers in constructor
11
+
10
12
  export class PasskeyServer extends PasskeyBase {
11
13
  private launchtubeJwt: string | undefined
12
14
  private mercuryJwt: string | undefined
13
15
  private mercuryKey: string | undefined
14
16
 
15
17
  public launchtubeUrl: string | undefined
18
+ public launchtubeHeaders: Record<string, string> | undefined
16
19
  public mercuryProjectName: string | undefined
17
20
  public mercuryUrl: string | undefined
18
21
 
@@ -20,6 +23,7 @@ export class PasskeyServer extends PasskeyBase {
20
23
  rpcUrl?: string,
21
24
  launchtubeUrl?: string,
22
25
  launchtubeJwt?: string,
26
+ launchtubeHeaders?: Record<string, string>
23
27
  mercuryProjectName?: string,
24
28
  mercuryUrl?: string,
25
29
  mercuryJwt?: string,
@@ -29,6 +33,7 @@ export class PasskeyServer extends PasskeyBase {
29
33
  rpcUrl,
30
34
  launchtubeUrl,
31
35
  launchtubeJwt,
36
+ launchtubeHeaders,
32
37
  mercuryProjectName,
33
38
  mercuryUrl,
34
39
  mercuryJwt,
@@ -43,6 +48,9 @@ export class PasskeyServer extends PasskeyBase {
43
48
  if (launchtubeJwt)
44
49
  this.launchtubeJwt = launchtubeJwt
45
50
 
51
+ if (launchtubeHeaders)
52
+ this.launchtubeHeaders = launchtubeHeaders
53
+
46
54
  if (mercuryProjectName)
47
55
  this.mercuryProjectName = mercuryProjectName
48
56
 
@@ -150,8 +158,11 @@ export class PasskeyServer extends PasskeyBase {
150
158
  - Add a method for getting a paginated or filtered list of all a wallet's events
151
159
  */
152
160
 
153
- public async send<T>(txn: AssembledTransaction<T> | Tx | string, fee?: number, headers?: Record<string, string>) {
154
- if (!this.launchtubeUrl || !this.launchtubeJwt)
161
+ public async send<T>(
162
+ txn: AssembledTransaction<T> | Tx | string,
163
+ fee?: number,
164
+ ) {
165
+ if (!this.launchtubeUrl)
155
166
  throw new Error('Launchtube service not configured')
156
167
 
157
168
  const data = new FormData();
@@ -167,14 +178,17 @@ export class PasskeyServer extends PasskeyBase {
167
178
  if (fee)
168
179
  data.set('fee', fee.toString());
169
180
 
181
+ let lt_headers = Object.assign({
182
+ 'X-Client-Name': 'passkey-kit',
183
+ 'X-Client-Version': version,
184
+ }, this.launchtubeHeaders)
185
+
186
+ if (this.launchtubeJwt)
187
+ lt_headers.authorization = `Bearer ${this.launchtubeJwt}`
188
+
170
189
  return fetch(this.launchtubeUrl, {
171
190
  method: 'POST',
172
- headers: {
173
- authorization: `Bearer ${this.launchtubeJwt}`,
174
- 'X-Client-Name': 'passkey-kit',
175
- 'X-Client-Version': version,
176
- ...headers
177
- },
191
+ headers: lt_headers,
178
192
  body: data
179
193
  }).then(async (res) => {
180
194
  if (res.ok)
package/tsconfig.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "outDir": "./types",
4
+ "rootDir": "./src",
4
5
  // Enable latest features
5
6
  "target": "ESNext",
6
7
  "module": "ESNext",
@@ -22,6 +23,6 @@
22
23
  "strictNullChecks": true,
23
24
  },
24
25
  "include": [
25
- "src/*",
26
+ "src",
26
27
  ],
27
28
  }
package/types/server.d.ts CHANGED
@@ -7,12 +7,14 @@ export declare class PasskeyServer extends PasskeyBase {
7
7
  private mercuryJwt;
8
8
  private mercuryKey;
9
9
  launchtubeUrl: string | undefined;
10
+ launchtubeHeaders: Record<string, string> | undefined;
10
11
  mercuryProjectName: string | undefined;
11
12
  mercuryUrl: string | undefined;
12
13
  constructor(options: {
13
14
  rpcUrl?: string;
14
15
  launchtubeUrl?: string;
15
16
  launchtubeJwt?: string;
17
+ launchtubeHeaders?: Record<string, string>;
16
18
  mercuryProjectName?: string;
17
19
  mercuryUrl?: string;
18
20
  mercuryJwt?: string;
@@ -1,6 +0,0 @@
1
- import { Server } from "@stellar/stellar-sdk/minimal/rpc";
2
- export declare class PasskeyBase {
3
- rpcUrl: string | undefined;
4
- rpc: Server | undefined;
5
- constructor(rpcUrl?: string);
6
- }
@@ -1,5 +0,0 @@
1
- export { SignerStore, SignerKey, type Signer, type SignerLimits } from './types';
2
- export { PasskeyKit } from "./kit";
3
- export { PasskeyServer } from "./server";
4
- export { SACClient } from "./sac";
5
- export { Client as PasskeyClient } from 'passkey-kit-sdk';
@@ -1,82 +0,0 @@
1
- import { Client as PasskeyClient } from 'passkey-kit-sdk';
2
- import { xdr, Keypair } from '@stellar/stellar-sdk/minimal';
3
- import type { AuthenticatorSelectionCriteria } from "@simplewebauthn/types";
4
- import { startRegistration, startAuthentication } from "@simplewebauthn/browser";
5
- import { Buffer } from 'buffer';
6
- import type { SignerKey, SignerLimits, SignerStore } from './types';
7
- import { PasskeyBase } from './base';
8
- import { AssembledTransaction, type Tx } from '@stellar/stellar-sdk/minimal/contract';
9
- import type { Server } from '@stellar/stellar-sdk/minimal/rpc';
10
- export declare class PasskeyKit extends PasskeyBase {
11
- rpc: Server;
12
- rpcUrl: string;
13
- private walletKeypair;
14
- private walletPublicKey;
15
- private walletWasmHash;
16
- private WebAuthn;
17
- keyId: string | undefined;
18
- networkPassphrase: string;
19
- wallet: PasskeyClient | undefined;
20
- constructor(options: {
21
- rpcUrl: string;
22
- networkPassphrase: string;
23
- walletWasmHash: string;
24
- WebAuthn?: {
25
- startRegistration: typeof startRegistration;
26
- startAuthentication: typeof startAuthentication;
27
- };
28
- });
29
- createWallet(app: string, user: string): Promise<{
30
- keyId: Buffer<ArrayBufferLike>;
31
- keyIdBase64: string;
32
- contractId: string;
33
- signedTx: Tx;
34
- }>;
35
- createKey(app: string, user: string, settings?: {
36
- rpId?: string;
37
- authenticatorSelection?: AuthenticatorSelectionCriteria;
38
- }): Promise<{
39
- keyId: Buffer<ArrayBufferLike>;
40
- keyIdBase64: string;
41
- publicKey: Buffer<ArrayBufferLike>;
42
- }>;
43
- connectWallet(opts?: {
44
- rpId?: string;
45
- keyId?: string | Uint8Array;
46
- getContractId?: (keyId: string) => Promise<string | undefined>;
47
- walletPublicKey?: string;
48
- }): Promise<{
49
- keyId: Buffer<ArrayBufferLike>;
50
- keyIdBase64: string;
51
- contractId: string;
52
- }>;
53
- signAuthEntry(entry: xdr.SorobanAuthorizationEntry, options?: {
54
- rpId?: string;
55
- keyId?: 'any' | string | Uint8Array;
56
- keypair?: Keypair;
57
- policy?: string;
58
- expiration?: number;
59
- }): Promise<xdr.SorobanAuthorizationEntry>;
60
- sign<T>(txn: AssembledTransaction<T> | Tx | string, options?: {
61
- rpId?: string;
62
- keyId?: 'any' | string | Uint8Array;
63
- keypair?: Keypair;
64
- policy?: string;
65
- expiration?: number;
66
- }): Promise<AssembledTransaction<T>>;
67
- addSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
68
- addEd25519(publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
69
- addPolicy(policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
70
- updateSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
71
- updateEd25519(publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
72
- updatePolicy(policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
73
- remove(signer: SignerKey): Promise<AssembledTransaction<null>>;
74
- private secp256r1;
75
- private ed25519;
76
- private policy;
77
- private getSignerLimits;
78
- private getSignerKey;
79
- private encodeContract;
80
- private getPublicKey;
81
- private compactSignature;
82
- }
@@ -1,13 +0,0 @@
1
- import { Client as SacClient } from 'sac-sdk';
2
- import { PasskeyBase } from "./base";
3
- import type { Server } from '@stellar/stellar-sdk/minimal/rpc';
4
- export declare class SACClient extends PasskeyBase {
5
- rpc: Server;
6
- rpcUrl: string;
7
- networkPassphrase: string;
8
- constructor(options: {
9
- networkPassphrase: string;
10
- rpcUrl: string;
11
- });
12
- getSACClient(SACContractId: string): SacClient;
13
- }
@@ -1,28 +0,0 @@
1
- import { PasskeyBase } from "./base";
2
- import type { Tx } from "@stellar/stellar-sdk/minimal/contract";
3
- import type { Signer } from "./types";
4
- import { AssembledTransaction } from "@stellar/stellar-sdk/minimal/contract";
5
- export declare class PasskeyServer extends PasskeyBase {
6
- private launchtubeJwt;
7
- private mercuryJwt;
8
- private mercuryKey;
9
- launchtubeUrl: string | undefined;
10
- mercuryProjectName: string | undefined;
11
- mercuryUrl: string | undefined;
12
- constructor(options: {
13
- rpcUrl?: string;
14
- launchtubeUrl?: string;
15
- launchtubeJwt?: string;
16
- mercuryProjectName?: string;
17
- mercuryUrl?: string;
18
- mercuryJwt?: string;
19
- mercuryKey?: string;
20
- });
21
- getSigners(contractId: string): Promise<Signer[]>;
22
- getContractId(options: {
23
- keyId?: string;
24
- publicKey?: string;
25
- policy?: string;
26
- }, index?: number): Promise<string>;
27
- send<T>(txn: AssembledTransaction<T> | Tx | string, fee?: number, headers?: Record<string, string>): Promise<any>;
28
- }
@@ -1,22 +0,0 @@
1
- export type Signer = {
2
- kind: string;
3
- key: string;
4
- val: string;
5
- expiration: number | null;
6
- storage: "Persistent" | "Temporary";
7
- limits: string;
8
- evicted?: boolean;
9
- };
10
- export declare class SignerKey {
11
- key: "Policy" | "Ed25519" | "Secp256r1";
12
- value: string;
13
- private constructor();
14
- static Policy(policy: string): SignerKey;
15
- static Ed25519(publicKey: string): SignerKey;
16
- static Secp256r1(id: string): SignerKey;
17
- }
18
- export type SignerLimits = Map<string, SignerKey[] | undefined> | undefined;
19
- export declare enum SignerStore {
20
- Persistent = "Persistent",
21
- Temporary = "Temporary"
22
- }