passkey-kit 0.5.0 → 0.5.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/src/kit.ts CHANGED
@@ -70,14 +70,14 @@ export class PasskeyKit extends PasskeyBase {
70
70
  name: displayName,
71
71
  displayName
72
72
  },
73
- authenticatorSelection: {
74
- requireResidentKey: false,
75
- residentKey: "preferred",
76
- userVerification: "discouraged",
77
- },
73
+ // authenticatorSelection: {
74
+ // requireResidentKey: false,
75
+ // residentKey: "preferred",
76
+ // userVerification: "discouraged",
77
+ // },
78
78
  pubKeyCredParams: [{ alg: -7, type: "public-key" }],
79
- attestation: "none",
80
- timeout: 120_000,
79
+ // attestation: "none",
80
+ // timeout: 120_000,
81
81
  });
82
82
 
83
83
  if (!this.keyId)
@@ -100,8 +100,8 @@ export class PasskeyKit extends PasskeyBase {
100
100
  const response = await startAuthentication({
101
101
  challenge: base64url("stellaristhebetterblockchain"),
102
102
  // rpId: undefined,
103
- userVerification: "discouraged",
104
- timeout: 120_000
103
+ // userVerification: "discouraged",
104
+ // timeout: 120_000
105
105
  });
106
106
 
107
107
  keyId = response.id
@@ -183,8 +183,8 @@ export class PasskeyKit extends PasskeyBase {
183
183
  ? {
184
184
  challenge: base64url(payload),
185
185
  // rpId: undefined,
186
- userVerification: "discouraged",
187
- timeout: 120_000
186
+ // userVerification: "discouraged",
187
+ // timeout: 120_000
188
188
  }
189
189
  : {
190
190
  challenge: base64url(payload),
@@ -197,8 +197,8 @@ export class PasskeyKit extends PasskeyBase {
197
197
  type: "public-key",
198
198
  },
199
199
  ],
200
- userVerification: "discouraged",
201
- timeout: 120_000
200
+ // userVerification: "discouraged",
201
+ // timeout: 120_000
202
202
  }
203
203
  );
204
204
 
@@ -327,13 +327,14 @@ export class PasskeyKit extends PasskeyBase {
327
327
  x = authenticatorData.slice(65 + credentialIdLength, 97 + credentialIdLength)
328
328
  y = authenticatorData.slice(100 + credentialIdLength, 132 + credentialIdLength)
329
329
  } else {
330
- const attestationData = base64url.toBuffer(response.attestationObject)
331
-
332
- let startIndex = attestationData.indexOf(0xa5, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20)
333
- startIndex = startIndex + startIndex.length
330
+ const attestationObject = base64url.toBuffer(response.attestationObject)
331
+
332
+ let publicKeykPrefixSlice = Buffer.from([0xa5, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20])
333
+ let startIndex = attestationObject.indexOf(publicKeykPrefixSlice)
334
+ startIndex = startIndex + publicKeykPrefixSlice.length
334
335
 
335
- x = attestationData.slice(startIndex, 32 + startIndex)
336
- y = attestationData.slice(35 + startIndex, 67 + startIndex)
336
+ x = attestationObject.slice(startIndex, 32 + startIndex)
337
+ y = attestationObject.slice(35 + startIndex, 67 + startIndex)
337
338
  }
338
339
 
339
340
  publicKey = Buffer.from([
package/src/sac.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { Client as SacClient } from 'sac-sdk'
2
+ import { PasskeyBase } from "./base"
3
+ import type { SorobanRpc } from '@stellar/stellar-sdk'
4
+
5
+ export class SACClient extends PasskeyBase {
6
+ declare public rpc: SorobanRpc.Server
7
+ declare public rpcUrl: string
8
+ public networkPassphrase: string
9
+
10
+ constructor(options: {
11
+ networkPassphrase: string,
12
+ rpcUrl: string
13
+ }) {
14
+ const { networkPassphrase, rpcUrl } = options
15
+
16
+ super(rpcUrl)
17
+
18
+ this.networkPassphrase = networkPassphrase
19
+ }
20
+
21
+ public getSACClient(SACContractId: string) {
22
+ return new SacClient({
23
+ contractId: SACContractId,
24
+ networkPassphrase: this.networkPassphrase,
25
+ rpcUrl: this.rpcUrl
26
+ })
27
+ }
28
+ }
package/tsconfig.json CHANGED
@@ -1,29 +1,32 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "outDir": "./types",
4
-
5
4
  // Enable latest features
6
5
  "target": "ESNext",
7
6
  "module": "ESNext",
8
7
  "moduleDetection": "force",
9
-
10
8
  // Bundler mode
11
9
  "moduleResolution": "node",
12
10
  "allowImportingTsExtensions": true,
13
11
  "verbatimModuleSyntax": true,
14
12
  "declaration": true,
15
13
  "emitDeclarationOnly": true,
16
-
17
14
  // Best practices
18
15
  "strict": true,
19
16
  "skipLibCheck": true,
20
17
  "noFallthroughCasesInSwitch": true,
21
-
22
18
  // Some stricter flags (disabled by default)
23
19
  "noUnusedLocals": false,
24
20
  "noUnusedParameters": false,
25
21
  "noPropertyAccessFromIndexSignature": false,
26
22
  "strictNullChecks": true,
27
23
  },
28
- "exclude": ["./demo", "./packages", "./types", "./contracts", "./zephyr", "./bun_tests"]
24
+ "exclude": [
25
+ "./bun_tests",
26
+ "./contracts",
27
+ "./demo",
28
+ "./packages",
29
+ "./types",
30
+ "./zephyr",
31
+ ]
29
32
  }
package/types/base.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SorobanRpc } from "@stellar/stellar-sdk";
2
2
  export declare class PasskeyBase {
3
- rpc: SorobanRpc.Server | undefined;
4
3
  rpcUrl: string | undefined;
4
+ rpc: SorobanRpc.Server | undefined;
5
5
  constructor(rpcUrl?: string);
6
6
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import { PasskeyServer } from "./server";
2
2
  import { PasskeyKit } from "./kit";
3
- export { PasskeyServer, PasskeyKit };
3
+ import { SACClient } from "./sac";
4
+ export { PasskeyServer, PasskeyKit, SACClient };
package/types/sac.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { Client as SacClient } from 'sac-sdk';
2
+ import { PasskeyBase } from "./base";
3
+ import type { SorobanRpc } from '@stellar/stellar-sdk';
4
+ export declare class SACClient extends PasskeyBase {
5
+ rpc: SorobanRpc.Server;
6
+ rpcUrl: string;
7
+ networkPassphrase: string;
8
+ constructor(options: {
9
+ networkPassphrase: string;
10
+ rpcUrl: string;
11
+ });
12
+ getSACClient(SACContractId: string): SacClient;
13
+ }
@@ -1,9 +0,0 @@
1
- export declare class PasskeyBase {
2
- launchtubeUrl: string | undefined;
3
- launchtubeJwt: string | undefined;
4
- constructor(options: {
5
- launchtubeUrl?: string;
6
- launchtubeJwt?: string;
7
- });
8
- send(xdr: string, fee?: number): Promise<any>;
9
- }
@@ -1,3 +0,0 @@
1
- import { PasskeyBase } from "./base";
2
- import { PasskeyKit } from "./kit";
3
- export { PasskeyBase, PasskeyKit };
@@ -1,53 +0,0 @@
1
- import { Client as PasskeyClient } from 'passkey-kit-sdk';
2
- import { Client as FactoryClient } from 'passkey-factory-sdk';
3
- import { Networks, xdr, Transaction, SorobanRpc } from '@stellar/stellar-sdk';
4
- import { Buffer } from 'buffer';
5
- import { PasskeyBase } from './base';
6
- type GetContractIdFunction = (keyId: string) => Promise<string>;
7
- export declare class PasskeyKit extends PasskeyBase {
8
- keyId: string | undefined;
9
- keyExpired: boolean | undefined;
10
- wallet: PasskeyClient | undefined;
11
- factory: FactoryClient;
12
- networkPassphrase: Networks;
13
- rpcUrl: string;
14
- rpc: SorobanRpc.Server;
15
- constructor(options: {
16
- rpcUrl: string;
17
- launchtubeUrl?: string;
18
- launchtubeJwt?: string;
19
- networkPassphrase: string;
20
- factoryContractId: string;
21
- });
22
- createWallet(name: string, user: string): Promise<{
23
- keyId: Buffer;
24
- contractId: string;
25
- xdr: string;
26
- }>;
27
- createKey(name: string, user: string): Promise<{
28
- keyId: Buffer;
29
- publicKey: Buffer;
30
- }>;
31
- connectWallet(opts: {
32
- keyId?: string | Uint8Array;
33
- getContractId?: GetContractIdFunction;
34
- }): Promise<{
35
- keyId: Buffer;
36
- contractId: string;
37
- }>;
38
- signAuthEntry(entry: xdr.SorobanAuthorizationEntry, options?: {
39
- keyId?: 'any' | string | Uint8Array;
40
- ledgersToLive?: number;
41
- }): Promise<xdr.SorobanAuthorizationEntry>;
42
- signAuthEntries(entries: xdr.SorobanAuthorizationEntry[], options?: {
43
- keyId?: 'any' | string | Uint8Array;
44
- ledgersToLive?: number;
45
- }): Promise<xdr.SorobanAuthorizationEntry[]>;
46
- sign(txn: Transaction | string, options?: {
47
- keyId?: 'any' | string | Uint8Array;
48
- ledgersToLive?: number;
49
- }): Promise<string>;
50
- private getPublicKeyObject;
51
- private convertEcdsaSignatureAsnToCompact;
52
- }
53
- export {};
@@ -1 +0,0 @@
1
- export {};