passkey-kit 0.0.19 → 0.0.21

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,9 +1,16 @@
1
1
  {
2
2
  "name": "passkey-kit",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
- "main": "./src/index.ts",
6
- "types": "./lib/index.d.ts",
5
+ "main": "src/index.ts",
6
+ "types": "types/index.d.ts",
7
+ "scripts": {
8
+ "build:demo": "cd demo && pnpm i && pnpm run build",
9
+ "prepublishOnly": "pnpm run build",
10
+ "build:pfs": "pnpm --filter ./packages/passkey-factory-sdk run build",
11
+ "build:pks": "pnpm --filter ./packages/passkey-kit-sdk run build",
12
+ "build": "pnpm run build:pfs && pnpm run build:pks && tsc"
13
+ },
7
14
  "dependencies": {
8
15
  "@simplewebauthn/browser": "^10.0.0",
9
16
  "@simplewebauthn/types": "^10.0.0",
@@ -12,18 +19,14 @@
12
19
  "bigint-conversion": "^2.4.3",
13
20
  "buffer": "^6.0.3",
14
21
  "cbor-x": "^1.5.9",
15
- "passkey-factory-sdk": "0.0.2",
16
- "passkey-kit-sdk": "0.0.2"
22
+ "passkey-factory-sdk": "workspace:*",
23
+ "passkey-kit": "^0.0.20",
24
+ "passkey-kit-sdk": "workspace:*"
17
25
  },
18
26
  "devDependencies": {
19
- "esbuild": "^0.21.4",
20
27
  "typescript": "^5.4.5"
21
28
  },
22
29
  "workspaces": [
23
30
  "packages/*"
24
- ],
25
- "scripts": {
26
- "build:demo": "cd demo && pnpm i && pnpm run build",
27
- "build": "tsc && node esbuild.js"
28
- }
31
+ ]
29
32
  }
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "0.0.2",
2
+ "version": "0.0.5",
3
3
  "name": "passkey-factory-sdk",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
- "types": "dist/index.d.ts",
6
+ "types": "types/index.d.ts",
7
7
  "scripts": {
8
- "preinstall": "pnpm run build",
8
+ "prepublishOnly": "pnpm run build",
9
9
  "build": "tsc"
10
10
  },
11
11
  "dependencies": {
@@ -41,10 +41,10 @@
41
41
  /* Emit */
42
42
  "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
43
43
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
44
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
44
+ "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
45
45
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
46
46
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
47
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
47
+ "outDir": "./types", /* Specify an output folder for all emitted files. */
48
48
  // "removeComments": true, /* Disable emitting comments. */
49
49
  // "noEmit": true, /* Disable emitting files from a compilation. */
50
50
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -0,0 +1,137 @@
1
+ import { Buffer } from "buffer";
2
+ import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, Result } from '@stellar/stellar-sdk/contract';
3
+ export * from '@stellar/stellar-sdk';
4
+ export * as contract from '@stellar/stellar-sdk/contract';
5
+ export * as rpc from '@stellar/stellar-sdk/rpc';
6
+ export declare const networks: {
7
+ readonly testnet: {
8
+ readonly networkPassphrase: "Test SDF Network ; September 2015";
9
+ readonly contractId: "CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3";
10
+ };
11
+ };
12
+ export declare const Errors: {
13
+ 1: {
14
+ message: string;
15
+ };
16
+ 2: {
17
+ message: string;
18
+ };
19
+ 3: {
20
+ message: string;
21
+ };
22
+ 4: {
23
+ message: string;
24
+ };
25
+ 5: {
26
+ message: string;
27
+ };
28
+ };
29
+ export interface Client {
30
+ /**
31
+ * 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.
32
+ */
33
+ extend_ttl: (options?: {
34
+ /**
35
+ * The fee to pay for the transaction. Default: BASE_FEE
36
+ */
37
+ fee?: number;
38
+ /**
39
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
40
+ */
41
+ timeoutInSeconds?: number;
42
+ /**
43
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
44
+ */
45
+ simulate?: boolean;
46
+ }) => Promise<AssembledTransaction<null>>;
47
+ /**
48
+ * 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.
49
+ */
50
+ init: ({ wasm_hash }: {
51
+ wasm_hash: Buffer;
52
+ }, options?: {
53
+ /**
54
+ * The fee to pay for the transaction. Default: BASE_FEE
55
+ */
56
+ fee?: number;
57
+ /**
58
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
59
+ */
60
+ timeoutInSeconds?: number;
61
+ /**
62
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
63
+ */
64
+ simulate?: boolean;
65
+ }) => Promise<AssembledTransaction<Result<void>>>;
66
+ /**
67
+ * Construct and simulate a deploy 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.
68
+ */
69
+ deploy: ({ id, pk }: {
70
+ id: Buffer;
71
+ pk: Buffer;
72
+ }, options?: {
73
+ /**
74
+ * The fee to pay for the transaction. Default: BASE_FEE
75
+ */
76
+ fee?: number;
77
+ /**
78
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
79
+ */
80
+ timeoutInSeconds?: number;
81
+ /**
82
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
83
+ */
84
+ simulate?: boolean;
85
+ }) => Promise<AssembledTransaction<Result<string>>>;
86
+ /**
87
+ * 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.
88
+ */
89
+ add_sig: ({ id, contract }: {
90
+ id: Buffer;
91
+ contract: string;
92
+ }, options?: {
93
+ /**
94
+ * The fee to pay for the transaction. Default: BASE_FEE
95
+ */
96
+ fee?: number;
97
+ /**
98
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
99
+ */
100
+ timeoutInSeconds?: number;
101
+ /**
102
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
103
+ */
104
+ simulate?: boolean;
105
+ }) => Promise<AssembledTransaction<Result<void>>>;
106
+ /**
107
+ * 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.
108
+ */
109
+ rm_sig: ({ id, contract }: {
110
+ id: Buffer;
111
+ contract: string;
112
+ }, options?: {
113
+ /**
114
+ * The fee to pay for the transaction. Default: BASE_FEE
115
+ */
116
+ fee?: number;
117
+ /**
118
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
119
+ */
120
+ timeoutInSeconds?: number;
121
+ /**
122
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
123
+ */
124
+ simulate?: boolean;
125
+ }) => Promise<AssembledTransaction<Result<void>>>;
126
+ }
127
+ export declare class Client extends ContractClient {
128
+ readonly options: ContractClientOptions;
129
+ constructor(options: ContractClientOptions);
130
+ readonly fromJSON: {
131
+ extend_ttl: (json: string) => AssembledTransaction<null>;
132
+ init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
133
+ deploy: (json: string) => AssembledTransaction<Result<string, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
134
+ add_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
135
+ rm_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
136
+ };
137
+ }
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "0.0.2",
2
+ "version": "0.0.5",
3
3
  "name": "passkey-kit-sdk",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
- "types": "dist/index.d.ts",
6
+ "types": "types/index.d.ts",
7
7
  "scripts": {
8
- "preinstall": "pnpm run build",
8
+ "prepublishOnly": "pnpm run build",
9
9
  "build": "tsc"
10
10
  },
11
11
  "dependencies": {
@@ -41,10 +41,10 @@
41
41
  /* Emit */
42
42
  "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
43
43
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
44
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
44
+ "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
45
45
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
46
46
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
47
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
47
+ "outDir": "./types", /* Specify an output folder for all emitted files. */
48
48
  // "removeComments": true, /* Disable emitting comments. */
49
49
  // "noEmit": true, /* Disable emitting files from a compilation. */
50
50
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -0,0 +1,158 @@
1
+ import { Buffer } from "buffer";
2
+ import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, Result } from '@stellar/stellar-sdk/contract';
3
+ export * from '@stellar/stellar-sdk';
4
+ export * as contract from '@stellar/stellar-sdk/contract';
5
+ export * as rpc from '@stellar/stellar-sdk/rpc';
6
+ export declare const networks: {
7
+ readonly testnet: {
8
+ readonly networkPassphrase: "Test SDF Network ; September 2015";
9
+ readonly contractId: "CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3";
10
+ };
11
+ };
12
+ export declare const Errors: {
13
+ 1: {
14
+ message: string;
15
+ };
16
+ 2: {
17
+ message: string;
18
+ };
19
+ 3: {
20
+ message: string;
21
+ };
22
+ 4: {
23
+ message: string;
24
+ };
25
+ 5: {
26
+ message: string;
27
+ };
28
+ 6: {
29
+ message: string;
30
+ };
31
+ 7: {
32
+ message: string;
33
+ };
34
+ 8: {
35
+ message: string;
36
+ };
37
+ 9: {
38
+ message: string;
39
+ };
40
+ 10: {
41
+ message: string;
42
+ };
43
+ };
44
+ export interface Signature {
45
+ authenticator_data: Buffer;
46
+ client_data_json: Buffer;
47
+ id: Buffer;
48
+ signature: Buffer;
49
+ }
50
+ export interface Client {
51
+ /**
52
+ * 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.
53
+ */
54
+ extend_ttl: (options?: {
55
+ /**
56
+ * The fee to pay for the transaction. Default: BASE_FEE
57
+ */
58
+ fee?: number;
59
+ /**
60
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
61
+ */
62
+ timeoutInSeconds?: number;
63
+ /**
64
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
65
+ */
66
+ simulate?: boolean;
67
+ }) => Promise<AssembledTransaction<null>>;
68
+ /**
69
+ * 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.
70
+ */
71
+ init: ({ id, pk, factory }: {
72
+ id: Buffer;
73
+ pk: Buffer;
74
+ factory: string;
75
+ }, options?: {
76
+ /**
77
+ * The fee to pay for the transaction. Default: BASE_FEE
78
+ */
79
+ fee?: number;
80
+ /**
81
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
82
+ */
83
+ timeoutInSeconds?: number;
84
+ /**
85
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
86
+ */
87
+ simulate?: boolean;
88
+ }) => Promise<AssembledTransaction<Result<void>>>;
89
+ /**
90
+ * 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.
91
+ */
92
+ resudo: ({ id }: {
93
+ id: Buffer;
94
+ }, options?: {
95
+ /**
96
+ * The fee to pay for the transaction. Default: BASE_FEE
97
+ */
98
+ fee?: number;
99
+ /**
100
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
101
+ */
102
+ timeoutInSeconds?: number;
103
+ /**
104
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
105
+ */
106
+ simulate?: boolean;
107
+ }) => Promise<AssembledTransaction<Result<void>>>;
108
+ /**
109
+ * 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.
110
+ */
111
+ rm_sig: ({ id }: {
112
+ id: Buffer;
113
+ }, options?: {
114
+ /**
115
+ * The fee to pay for the transaction. Default: BASE_FEE
116
+ */
117
+ fee?: number;
118
+ /**
119
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
120
+ */
121
+ timeoutInSeconds?: number;
122
+ /**
123
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
124
+ */
125
+ simulate?: boolean;
126
+ }) => Promise<AssembledTransaction<Result<void>>>;
127
+ /**
128
+ * 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.
129
+ */
130
+ add_sig: ({ id, pk }: {
131
+ id: Buffer;
132
+ pk: Buffer;
133
+ }, options?: {
134
+ /**
135
+ * The fee to pay for the transaction. Default: BASE_FEE
136
+ */
137
+ fee?: number;
138
+ /**
139
+ * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
140
+ */
141
+ timeoutInSeconds?: number;
142
+ /**
143
+ * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
144
+ */
145
+ simulate?: boolean;
146
+ }) => Promise<AssembledTransaction<Result<void>>>;
147
+ }
148
+ export declare class Client extends ContractClient {
149
+ readonly options: ContractClientOptions;
150
+ constructor(options: ContractClientOptions);
151
+ readonly fromJSON: {
152
+ extend_ttl: (json: string) => AssembledTransaction<null>;
153
+ init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
154
+ resudo: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
155
+ rm_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
156
+ add_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
157
+ };
158
+ }
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "outDir": "./lib",
3
+ "outDir": "./types",
4
4
 
5
5
  // Enable latest features
6
6
  "target": "ESNext",
@@ -26,5 +26,5 @@
26
26
  "noPropertyAccessFromIndexSignature": false,
27
27
  "strictNullChecks": true,
28
28
  },
29
- "exclude": ["./demo", "./packages", "./lib"]
29
+ "exclude": ["./demo", "./packages", "./types"]
30
30
  }
@@ -0,0 +1,46 @@
1
+ import { Client as PasskeyClient } from 'passkey-kit-sdk';
2
+ import { Client as FactoryClient } from 'passkey-factory-sdk';
3
+ import { Networks, Transaction, Horizon, SorobanRpc } from '@stellar/stellar-sdk';
4
+ import { Buffer } from 'buffer';
5
+ export declare class PasskeyAccount {
6
+ id: string | undefined;
7
+ sudo: string | undefined;
8
+ wallet: PasskeyClient | undefined;
9
+ factory: FactoryClient;
10
+ sequencePublicKey: string;
11
+ networkPassphrase: Networks;
12
+ horizonUrl: string;
13
+ horizon: Horizon.Server;
14
+ rpcUrl: string;
15
+ rpc: SorobanRpc.Server;
16
+ feeBumpUrl: string;
17
+ feeBumpJwt: string;
18
+ factoryContractId: string;
19
+ constructor(options: {
20
+ sequencePublicKey: string;
21
+ networkPassphrase: Networks;
22
+ horizonUrl: string;
23
+ rpcUrl: string;
24
+ feeBumpUrl: string;
25
+ feeBumpJwt: string;
26
+ factoryContractId?: string;
27
+ });
28
+ createWallet(name: string, user: string): Promise<{
29
+ contractId: string;
30
+ xdr: string;
31
+ }>;
32
+ createKey(name: string, user: string): Promise<{
33
+ keyId: Buffer;
34
+ publicKey: Buffer | undefined;
35
+ }>;
36
+ connectWallet(): Promise<string>;
37
+ sign(txn: Transaction | string, options?: {
38
+ id?: 'any' | 'sudo' | string | Uint8Array;
39
+ ttl?: number;
40
+ }): Promise<string>;
41
+ send(txn: Transaction, fee?: number): Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
42
+ getData(): Promise<Map<string, any>>;
43
+ private getKey;
44
+ private getPublicKeyObject;
45
+ private convertEcdsaSignatureAsnToCompact;
46
+ }
package/_package.json DELETED
@@ -1,39 +0,0 @@
1
- {
2
- "name": "passkey-kit",
3
- "main": "./lib/index.js",
4
- "types": "./lib/index.d.ts",
5
- "version": "0.0.7",
6
- "type": "module",
7
- "scripts": {
8
- "build:demo": "cd demo && pnpm i && pnpm run build",
9
- "prepare": "pnpm build",
10
- "preinstall": "npm run build -w passkey-factory-sdk && npm run build -w passkey-kit-sdk && pnpm run build",
11
- "build": "npx tsc && node esbuild.js",
12
- "publish": "pnpm run build && npm publish",
13
- "publish:workspaces": "pnpm run build && npm publish --workspaces",
14
- "build:packages:f": "cd packages/passkey-factory-sdk && pnpm run build",
15
- "build:packages:k": "cd packages/passkey-kit-sdk && pnpm run build",
16
- },
17
- "dependencies": {
18
- "@simplewebauthn/browser": "^10.0.0",
19
- "@simplewebauthn/types": "^10.0.0",
20
- "@stellar/stellar-sdk": "12.0.0-rc.3",
21
- "base64url": "^3.0.1",
22
- "bigint-conversion": "^2.4.3",
23
- "buffer": "^6.0.3",
24
- "cbor-x": "^1.5.9",
25
- "passkey-factory-sdk": "workspace:*",
26
- "passkey-kit-sdk": "workspace:*"
27
- },
28
- "devDependencies": {
29
- "esbuild": "^0.21.4",
30
- "esbuild-plugin-polyfill-node": "^0.3.0",
31
- "typescript": "^5.4.5"
32
- },
33
- "files": [
34
- "lib/**/*", "packages/**/*"
35
- ],
36
- "workspaces": [
37
- "packages/*"
38
- ]
39
- }
package/esbuild.js DELETED
@@ -1,17 +0,0 @@
1
- import { build } from 'esbuild'
2
- import fs from 'fs'
3
-
4
- const result = await build({
5
- metafile: true,
6
- bundle: true,
7
- format: 'esm',
8
- charset: 'utf8',
9
- outdir: 'lib',
10
- entryPoints: ['src/index.ts'],
11
- minify: true,
12
- logLevel: 'silent',
13
- resolveExtensions: ['.tsx', '.ts', '.jsx', '.mjs', '.js', '.json'],
14
- platform: 'browser',
15
- })
16
-
17
- fs.writeFileSync('meta.json', JSON.stringify(result.metafile))