@thru/passkey-manager 0.2.1

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/types.ts ADDED
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Result of passkey registration (credential creation).
3
+ */
4
+ export interface PasskeyRegistrationResult {
5
+ credentialId: string; // base64url-encoded
6
+ publicKeyX: string; // hex-encoded (32 bytes)
7
+ publicKeyY: string; // hex-encoded (32 bytes)
8
+ rpId: string;
9
+ }
10
+
11
+ /**
12
+ * Result of passkey signing (assertion).
13
+ */
14
+ export interface PasskeySigningResult {
15
+ signature: Uint8Array; // Raw P-256 signature (r || s, 64 bytes)
16
+ authenticatorData: Uint8Array;
17
+ clientDataJSON: Uint8Array;
18
+ signatureR: Uint8Array; // 32 bytes
19
+ signatureS: Uint8Array; // 32 bytes
20
+ }
21
+
22
+ /**
23
+ * Signing result with discoverable credential info.
24
+ */
25
+ export interface PasskeyDiscoverableSigningResult extends PasskeySigningResult {
26
+ credentialId: string; // base64url-encoded
27
+ rpId: string;
28
+ }
29
+
30
+ /**
31
+ * Passkey metadata stored locally (the actual private key lives in the device's secure enclave).
32
+ */
33
+ export interface PasskeyMetadata {
34
+ credentialId: string;
35
+ publicKeyX: string;
36
+ publicKeyY: string;
37
+ rpId: string;
38
+ label?: string;
39
+ createdAt: string;
40
+ lastUsedAt: string;
41
+ }
42
+
43
+ export type Authority =
44
+ | {
45
+ tag: 1; // passkey
46
+ pubkeyX: Uint8Array; // 32 bytes
47
+ pubkeyY: Uint8Array; // 32 bytes
48
+ }
49
+ | {
50
+ tag: 2; // pubkey
51
+ pubkey: Uint8Array; // 32 bytes
52
+ };
53
+
54
+ export interface CreateInstructionParams {
55
+ walletAccountIdx: number;
56
+ authority: Authority;
57
+ seed: Uint8Array;
58
+ stateProof: Uint8Array;
59
+ }
60
+
61
+ export interface TransferInstructionParams {
62
+ walletAccountIdx: number;
63
+ toAccountIdx: number;
64
+ amount: bigint;
65
+ }
66
+
67
+ export interface ValidateInstructionParams {
68
+ walletAccountIdx: number;
69
+ authIdx: number;
70
+ signatureR: Uint8Array;
71
+ signatureS: Uint8Array;
72
+ authenticatorData: Uint8Array;
73
+ clientDataJSON: Uint8Array;
74
+ }
75
+
76
+ export interface AccountContext {
77
+ readWriteAddresses: string[];
78
+ readOnlyAddresses: string[];
79
+ accountAddresses: string[];
80
+ walletAccountIdx: number;
81
+ getAccountIndex: (pubkey: Uint8Array) => number;
82
+ }
83
+
84
+ export type WalletSigner = {
85
+ signTransaction: (payloadBase64: string) => Promise<string>;
86
+ };
87
+
88
+ export type TransactionExecutionSummary = {
89
+ executionResult?: bigint | number | null;
90
+ userErrorCode?: bigint | number | null;
91
+ vmError?: number | string | bigint | null;
92
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ format: ['esm', 'cjs'],
5
+ entry: { index: 'src/index.ts' },
6
+ dts: true,
7
+ sourcemap: true,
8
+ clean: true,
9
+ target: 'es2020',
10
+ tsconfig: 'tsconfig.json',
11
+ });