@thru/passkey 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,149 @@
1
+ import type { PasskeySigningResult, PasskeyMetadata } from '@thru/passkey-manager';
2
+
3
+ // Re-export platform-agnostic types for backward compatibility
4
+ export type {
5
+ PasskeyRegistrationResult,
6
+ PasskeySigningResult,
7
+ PasskeyDiscoverableSigningResult,
8
+ PasskeyMetadata,
9
+ } from '@thru/passkey-manager';
10
+
11
+ /**
12
+ * Signing result with stored passkey metadata attached.
13
+ */
14
+ export interface PasskeyStoredSigningResult extends PasskeySigningResult {
15
+ passkey: PasskeyMetadata;
16
+ accounts?: PasskeyPopupAccount[];
17
+ }
18
+
19
+ /**
20
+ * WebAuthn client capabilities map.
21
+ */
22
+ export interface PasskeyClientCapabilities {
23
+ conditionalCreate?: boolean;
24
+ conditionalGet?: boolean;
25
+ credentialProtectionPolicy?: boolean;
26
+ credProps?: boolean;
27
+ minPinLength?: boolean;
28
+ multiFactor?: boolean;
29
+ passkeyPlatformAuthenticator?: boolean;
30
+ largeBlob?: boolean;
31
+ rpId?: boolean;
32
+ userVerifyingPlatformAuthenticator?: boolean;
33
+ relatedOrigins?: boolean;
34
+ }
35
+
36
+ /**
37
+ * Context sent to popup for display purposes.
38
+ */
39
+ export interface PasskeyPopupContext {
40
+ appId?: string;
41
+ appName?: string;
42
+ appUrl?: string;
43
+ origin?: string;
44
+ imageUrl?: string;
45
+ }
46
+
47
+ /**
48
+ * Account info passed through popup bridge.
49
+ */
50
+ export interface PasskeyPopupAccount {
51
+ index: number;
52
+ label?: string;
53
+ publicKey: string;
54
+ path?: string;
55
+ createdAt?: string;
56
+ addressType?: string;
57
+ publicKeyRawBase64?: string;
58
+ }
59
+
60
+ // Popup types
61
+ export type PasskeyPopupAction = 'get' | 'create' | 'getStored';
62
+
63
+ export interface PasskeyPopupGetRequestPayload {
64
+ credentialId: string;
65
+ challengeBase64Url: string;
66
+ rpId: string;
67
+ }
68
+
69
+ export interface PasskeyPopupCreateRequestPayload {
70
+ alias: string;
71
+ userId: string;
72
+ }
73
+
74
+ export interface PasskeyPopupGetStoredRequestPayload {
75
+ challengeBase64Url: string;
76
+ context?: PasskeyPopupContext;
77
+ }
78
+
79
+ export type PasskeyPopupRequestPayload =
80
+ | PasskeyPopupGetRequestPayload
81
+ | PasskeyPopupCreateRequestPayload
82
+ | PasskeyPopupGetStoredRequestPayload;
83
+
84
+ export interface PasskeyPopupRequest {
85
+ type: string;
86
+ requestId: string;
87
+ action: PasskeyPopupAction;
88
+ payload: PasskeyPopupRequestPayload;
89
+ }
90
+
91
+ export interface PasskeyPopupSigningResult {
92
+ signatureBase64Url: string;
93
+ authenticatorDataBase64Url: string;
94
+ clientDataJSONBase64Url: string;
95
+ signatureRBase64Url: string;
96
+ signatureSBase64Url: string;
97
+ }
98
+
99
+ export interface PasskeyPopupStoredPasskey {
100
+ credentialId: string;
101
+ publicKeyX: string;
102
+ publicKeyY: string;
103
+ rpId: string;
104
+ label?: string;
105
+ createdAt: string;
106
+ lastUsedAt: string;
107
+ }
108
+
109
+ export interface PasskeyPopupStoredSigningResult extends PasskeyPopupSigningResult {
110
+ passkey: PasskeyPopupStoredPasskey;
111
+ accounts?: PasskeyPopupAccount[];
112
+ }
113
+
114
+ export interface PasskeyPopupRegistrationResult {
115
+ credentialId: string;
116
+ publicKeyX: string;
117
+ publicKeyY: string;
118
+ rpId: string;
119
+ }
120
+
121
+ export type PasskeyPopupResponse =
122
+ | {
123
+ type: string;
124
+ requestId: string;
125
+ action: 'get';
126
+ success: true;
127
+ result: PasskeyPopupSigningResult;
128
+ }
129
+ | {
130
+ type: string;
131
+ requestId: string;
132
+ action: 'create';
133
+ success: true;
134
+ result: PasskeyPopupRegistrationResult;
135
+ }
136
+ | {
137
+ type: string;
138
+ requestId: string;
139
+ action: 'getStored';
140
+ success: true;
141
+ result: PasskeyPopupStoredSigningResult;
142
+ }
143
+ | {
144
+ type: string;
145
+ requestId: string;
146
+ action: PasskeyPopupAction;
147
+ success: false;
148
+ error: { name?: string; message: string };
149
+ };
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
+ });