@passkeyme/auth 1.0.0
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/CHANGELOG.md +93 -0
- package/LICENSE +21 -0
- package/README.md +598 -0
- package/dist/index.esm.js +5660 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +5680 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +5686 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/src/api-client.d.ts +56 -0
- package/dist/src/api-client.d.ts.map +1 -0
- package/dist/src/errors.d.ts +61 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/http-interceptors.d.ts +28 -0
- package/dist/src/http-interceptors.d.ts.map +1 -0
- package/dist/src/index.d.ts +49 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/passkeyme-auth.d.ts +157 -0
- package/dist/src/passkeyme-auth.d.ts.map +1 -0
- package/dist/src/platform/PasskeySDK.d.ts +112 -0
- package/dist/src/platform/PasskeySDK.d.ts.map +1 -0
- package/dist/src/platform/ReactNativePasskeySDK.d.ts +42 -0
- package/dist/src/platform/ReactNativePasskeySDK.d.ts.map +1 -0
- package/dist/src/platform/WebPasskeySDK.d.ts +25 -0
- package/dist/src/platform/WebPasskeySDK.d.ts.map +1 -0
- package/dist/src/platform/index.d.ts +8 -0
- package/dist/src/platform/index.d.ts.map +1 -0
- package/dist/src/storage/BrowserStorageProvider.d.ts +14 -0
- package/dist/src/storage/BrowserStorageProvider.d.ts.map +1 -0
- package/dist/src/storage/StorageProvider.d.ts +32 -0
- package/dist/src/storage/StorageProvider.d.ts.map +1 -0
- package/dist/src/storage/index.d.ts +6 -0
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/src/token-storage.d.ts +46 -0
- package/dist/src/token-storage.d.ts.map +1 -0
- package/dist/src/types.d.ts +217 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/logger.d.ts +23 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/test/platform/PasskeySDK.test.d.ts +5 -0
- package/dist/test/platform/PasskeySDK.test.d.ts.map +1 -0
- package/dist/test/setup.d.ts +13 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/storage/BrowserStorageProvider.test.d.ts +5 -0
- package/dist/test/storage/BrowserStorageProvider.test.d.ts.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secure token storage for PasskeyMe Auth SDK
|
|
3
|
+
*/
|
|
4
|
+
import { AuthTokens } from "./types";
|
|
5
|
+
import { StorageProvider } from "./storage";
|
|
6
|
+
export declare class TokenStorage {
|
|
7
|
+
private static readonly ACCESS_TOKEN_KEY;
|
|
8
|
+
private static readonly REFRESH_TOKEN_KEY;
|
|
9
|
+
private static readonly EXPIRES_AT_KEY;
|
|
10
|
+
private static readonly TOKEN_TYPE_KEY;
|
|
11
|
+
private storage;
|
|
12
|
+
constructor(storage?: StorageProvider, useSessionStorage?: boolean);
|
|
13
|
+
/**
|
|
14
|
+
* Store authentication tokens
|
|
15
|
+
*/
|
|
16
|
+
setTokens(tokens: AuthTokens): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Get stored authentication tokens
|
|
19
|
+
*/
|
|
20
|
+
getTokens(): Promise<AuthTokens | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Get access token if valid
|
|
23
|
+
*/
|
|
24
|
+
getAccessToken(): Promise<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Get refresh token
|
|
27
|
+
*/
|
|
28
|
+
getRefreshToken(): Promise<string | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if tokens are expired
|
|
31
|
+
*/
|
|
32
|
+
isTokenExpired(): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if tokens are about to expire (within 5 minutes)
|
|
35
|
+
*/
|
|
36
|
+
isTokenExpiringSoon(): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Clear all stored tokens
|
|
39
|
+
*/
|
|
40
|
+
clearTokens(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Update only the access token (for refresh operations)
|
|
43
|
+
*/
|
|
44
|
+
updateAccessToken(accessToken: string, expiresAt: number): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=token-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-storage.d.ts","sourceRoot":"","sources":["../../src/token-storage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAA0B,MAAM,WAAW,CAAC;AAEpE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAA4B;IACpE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;IACtE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA0B;IAChE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA0B;IAEhE,OAAO,CAAC,OAAO,CAAkB;gBAErB,OAAO,CAAC,EAAE,eAAe,EAAE,iBAAiB,GAAE,OAAe;IAIzE;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBlD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IA0B7C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAkB9C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAK/C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAWxC;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAa7C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAOlC;;OAEG;IACG,iBAAiB,CACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;CAOjB"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for PasskeyMe Auth SDK
|
|
3
|
+
*/
|
|
4
|
+
import { StorageProvider } from "./storage";
|
|
5
|
+
import type { PasskeySDK } from "./platform";
|
|
6
|
+
export interface PasskeymeConfig {
|
|
7
|
+
/** Your PasskeyMe application ID */
|
|
8
|
+
appId: string;
|
|
9
|
+
/** Base URL of your PasskeyMe server (defaults to https://auth.passkeyme.com) */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Custom API URL for your PasskeyMe server (alias for baseUrl)
|
|
13
|
+
* Use this for custom domains or self-hosted setups
|
|
14
|
+
* @example 'https://auth.yourdomain.com' or 'http://localhost:8000'
|
|
15
|
+
*/
|
|
16
|
+
apiUrl?: string;
|
|
17
|
+
/** Redirect URI after authentication (defaults to current origin + /auth/callback) */
|
|
18
|
+
redirectUri?: string;
|
|
19
|
+
/** Whether to enable debug logging */
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
/** Authentication mode: 'hosted' uses PasskeyMe hosted auth pages, 'direct' for custom UI */
|
|
22
|
+
mode?: "hosted" | "direct";
|
|
23
|
+
/** Your PasskeyMe API key for WebAuthn operations */
|
|
24
|
+
passkeyApiKey?: string;
|
|
25
|
+
/** Whether to prompt for passkey registration after successful auth (default: true) */
|
|
26
|
+
autoPromptPasskeyRegistration?: boolean;
|
|
27
|
+
/** Whether to enable passkey login buttons (default: true) */
|
|
28
|
+
enablePasskeyLogin?: boolean;
|
|
29
|
+
/** Custom passkey registration prompt message */
|
|
30
|
+
passkeyRegistrationPrompt?: string;
|
|
31
|
+
/** Custom storage provider (defaults to BrowserStorageProvider with localStorage) */
|
|
32
|
+
storage?: StorageProvider;
|
|
33
|
+
/** Custom passkey SDK implementation (platform-specific) */
|
|
34
|
+
passkeySDK?: PasskeySDK;
|
|
35
|
+
/** @deprecated Use passkeyApiKey instead */
|
|
36
|
+
passkey?: {
|
|
37
|
+
/** @deprecated Use autoPromptPasskeyRegistration instead */
|
|
38
|
+
autoPromptRegistration?: boolean;
|
|
39
|
+
/** @deprecated Use enablePasskeyLogin instead */
|
|
40
|
+
enableLogin?: boolean;
|
|
41
|
+
/** @deprecated Use passkeyApiKey instead */
|
|
42
|
+
apiKey?: string;
|
|
43
|
+
/** @deprecated Use passkeyRegistrationPrompt instead */
|
|
44
|
+
registrationPrompt?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface User {
|
|
48
|
+
/** Unique user identifier */
|
|
49
|
+
id: string;
|
|
50
|
+
/** User's email address */
|
|
51
|
+
email?: string;
|
|
52
|
+
/** User's display name */
|
|
53
|
+
name?: string;
|
|
54
|
+
/** User's profile picture URL */
|
|
55
|
+
picture?: string;
|
|
56
|
+
/** Authentication provider used (google, github, passkey, password) */
|
|
57
|
+
provider?: string;
|
|
58
|
+
/** When the user was created */
|
|
59
|
+
createdAt?: string;
|
|
60
|
+
/** When the user last logged in */
|
|
61
|
+
lastLoginAt?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface AuthTokens {
|
|
64
|
+
/** JWT access token */
|
|
65
|
+
accessToken: string;
|
|
66
|
+
/** Refresh token for getting new access tokens */
|
|
67
|
+
refreshToken?: string;
|
|
68
|
+
/** Token expiration time (Unix timestamp) */
|
|
69
|
+
expiresAt: number;
|
|
70
|
+
/** Token type (usually "Bearer") */
|
|
71
|
+
tokenType?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface PasskeyRegistrationOptions {
|
|
74
|
+
/** Username for the passkey (usually email) */
|
|
75
|
+
username: string;
|
|
76
|
+
/** Display name for the passkey (usually full name) */
|
|
77
|
+
displayName?: string;
|
|
78
|
+
/** Whether to require user verification */
|
|
79
|
+
requireUserVerification?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface PasskeyRegistrationResult {
|
|
82
|
+
/** Whether registration was successful */
|
|
83
|
+
success: boolean;
|
|
84
|
+
/** Error message if registration failed */
|
|
85
|
+
error?: string;
|
|
86
|
+
/** Credential ID if registration was successful */
|
|
87
|
+
credentialId?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface AuthState {
|
|
90
|
+
/** Currently authenticated user (null if not authenticated) */
|
|
91
|
+
user: User | null;
|
|
92
|
+
/** Whether authentication is currently loading */
|
|
93
|
+
loading: boolean;
|
|
94
|
+
/** Authentication error if any */
|
|
95
|
+
error: string | null;
|
|
96
|
+
/** Whether user is authenticated */
|
|
97
|
+
isAuthenticated: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface LoginOptions {
|
|
100
|
+
/** Custom redirect URI for this login */
|
|
101
|
+
redirectUri?: string;
|
|
102
|
+
/** Additional state to pass through authentication */
|
|
103
|
+
state?: string;
|
|
104
|
+
/** Force a specific authentication method on hosted page */
|
|
105
|
+
authMethod?: "oauth" | "passkey" | "password";
|
|
106
|
+
/** Specific OAuth provider to use */
|
|
107
|
+
provider?: "google" | "github" | "facebook";
|
|
108
|
+
}
|
|
109
|
+
export interface AuthEvent {
|
|
110
|
+
/** Event type */
|
|
111
|
+
type: "login" | "logout" | "token_refresh" | "error";
|
|
112
|
+
/** User data (for login events) */
|
|
113
|
+
user?: User;
|
|
114
|
+
/** Error message (for error events) */
|
|
115
|
+
error?: string;
|
|
116
|
+
/** Event timestamp */
|
|
117
|
+
timestamp: number;
|
|
118
|
+
}
|
|
119
|
+
export type AuthEventListener = (event: AuthEvent) => void;
|
|
120
|
+
export type AuthStateListener = (state: AuthState) => void;
|
|
121
|
+
export interface PasskeymeAuthInstance {
|
|
122
|
+
/** Current authentication state */
|
|
123
|
+
readonly state: AuthState;
|
|
124
|
+
/** Initialize the SDK */
|
|
125
|
+
init(): Promise<void>;
|
|
126
|
+
/** Redirect to hosted auth page for login */
|
|
127
|
+
redirectToLogin(options?: LoginOptions): void;
|
|
128
|
+
/** Redirect to hosted auth page with specific OAuth provider */
|
|
129
|
+
redirectToOAuth(provider: "google" | "github" | "facebook", redirectUri?: string): void;
|
|
130
|
+
/** Handle OAuth callback from hosted auth page */
|
|
131
|
+
handleAuthCallback(): Promise<User>;
|
|
132
|
+
/** Handle OAuth callback from hosted auth page (legacy method name) */
|
|
133
|
+
handleCallback(): Promise<User>;
|
|
134
|
+
/** Handle authentication callback (call this on your redirect URI page) */
|
|
135
|
+
handleCallback(): Promise<User>;
|
|
136
|
+
/** Handle direct token authentication (when token is sent directly instead of auth code) */
|
|
137
|
+
handleTokenCallback(token: string): Promise<User>;
|
|
138
|
+
/** Logout current user */
|
|
139
|
+
logout(): Promise<void>;
|
|
140
|
+
/** Get current user */
|
|
141
|
+
getCurrentUser(): User | null;
|
|
142
|
+
/** Get current access token */
|
|
143
|
+
getAccessToken(): Promise<string | null>;
|
|
144
|
+
/** Refresh access token */
|
|
145
|
+
refreshToken(): Promise<string>;
|
|
146
|
+
/** Add event listener */
|
|
147
|
+
addEventListener(listener: AuthEventListener): () => void;
|
|
148
|
+
/** Remove event listener */
|
|
149
|
+
removeEventListener(listener: AuthEventListener): void;
|
|
150
|
+
/** Subscribe to state changes */
|
|
151
|
+
subscribe(listener: AuthStateListener): () => void;
|
|
152
|
+
/** Get current state */
|
|
153
|
+
getState(): AuthState;
|
|
154
|
+
/** Get the base URL configured for this auth instance */
|
|
155
|
+
getBaseUrl(): string;
|
|
156
|
+
/** Get the app ID configured for this auth instance */
|
|
157
|
+
getAppId(): string;
|
|
158
|
+
/** Check if passkeys are supported on this device */
|
|
159
|
+
isPasskeySupported(): boolean;
|
|
160
|
+
/** Check if user has registered passkeys */
|
|
161
|
+
hasStoredPasskeys(username?: string): Promise<boolean>;
|
|
162
|
+
/** Mark passkey availability for a user */
|
|
163
|
+
setPasskeyAvailable(username: string, available?: boolean): Promise<void>;
|
|
164
|
+
/** Store username for future smart login attempts */
|
|
165
|
+
storeUsername(username: string): Promise<void>;
|
|
166
|
+
/** Authenticate with passkey */
|
|
167
|
+
passkeyLogin(username: string | undefined, apiKey: string): Promise<User>;
|
|
168
|
+
/** Smart login: try passkey first, fallback to hosted auth */
|
|
169
|
+
smartLogin(username?: string, apiKey?: string): Promise<{
|
|
170
|
+
method: "passkey" | "redirect";
|
|
171
|
+
user?: User;
|
|
172
|
+
}>;
|
|
173
|
+
/** Get app configuration including OAuth providers */
|
|
174
|
+
getAppConfig(): Promise<AppConfiguration>;
|
|
175
|
+
}
|
|
176
|
+
export interface HttpInterceptorConfig {
|
|
177
|
+
/** Whether to automatically add Authorization header */
|
|
178
|
+
autoAddAuthHeader?: boolean;
|
|
179
|
+
/** Custom header name (defaults to "Authorization") */
|
|
180
|
+
headerName?: string;
|
|
181
|
+
/** Custom token prefix (defaults to "Bearer ") */
|
|
182
|
+
tokenPrefix?: string;
|
|
183
|
+
/** Whether to automatically refresh expired tokens */
|
|
184
|
+
autoRefresh?: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface ApiError extends Error {
|
|
187
|
+
/** HTTP status code */
|
|
188
|
+
status?: number;
|
|
189
|
+
/** Error code from API */
|
|
190
|
+
code?: string;
|
|
191
|
+
/** Additional error details */
|
|
192
|
+
details?: any;
|
|
193
|
+
}
|
|
194
|
+
export interface AppConfiguration {
|
|
195
|
+
/** Application ID */
|
|
196
|
+
appId: string;
|
|
197
|
+
/** Application name */
|
|
198
|
+
name: string;
|
|
199
|
+
/** Whether discoverable credentials are enabled for this app */
|
|
200
|
+
discoverableCredentialsEnabled: boolean;
|
|
201
|
+
/** Available OAuth providers */
|
|
202
|
+
oauthProviders: string[];
|
|
203
|
+
/** Whether passkey authentication is enabled */
|
|
204
|
+
passkeyEnabled: boolean;
|
|
205
|
+
/** Whether password authentication is enabled */
|
|
206
|
+
passwordEnabled: boolean;
|
|
207
|
+
/** App branding configuration */
|
|
208
|
+
branding?: {
|
|
209
|
+
/** App logo URL */
|
|
210
|
+
logoUrl?: string;
|
|
211
|
+
/** Primary color */
|
|
212
|
+
primaryColor?: string;
|
|
213
|
+
/** App display name */
|
|
214
|
+
displayName?: string;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6FAA6F;IAC7F,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iDAAiD;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,qFAAqF;IACrF,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB,4CAA4C;IAC5C,OAAO,CAAC,EAAE;QACR,4DAA4D;QAC5D,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,iDAAiD;QACjD,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,4CAA4C;QAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,wDAAwD;QACxD,kBAAkB,C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|
1
|
+
/**
|
|
2
|
+
* Internal logging utility for PasskeyMe SDK
|
|
3
|
+
* Provides controlled logging that can be enabled/disabled in production
|
|
4
|
+
*/
|
|
5
|
+
export interface LoggerConfig {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
level: "debug" | "info" | "warn" | "error";
|
|
8
|
+
prefix?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class Logger {
|
|
11
|
+
private config;
|
|
12
|
+
constructor(config?: Partial<LoggerConfig>);
|
|
13
|
+
private shouldLog;
|
|
14
|
+
private formatMessage;
|
|
15
|
+
debug(message: string, ...args: any[]): void;
|
|
16
|
+
info(message: string, ...args: any[]): void;
|
|
17
|
+
warn(message: string, ...args: any[]): void;
|
|
18
|
+
error(message: string, ...args: any[]): void;
|
|
19
|
+
log(message: string, ...args: any[]): void;
|
|
20
|
+
}
|
|
21
|
+
export declare const logger: Logger;
|
|
22
|
+
export declare const storageLogger: Logger;
|
|
23
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IAS9C,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,aAAa;IAKrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5C,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAG3C;AAGD,eAAO,MAAM,MAAM,QAAe,CAAC;AAGnC,eAAO,MAAM,aAAa,QAExB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasskeySDK.test.d.ts","sourceRoot":"","sources":["../../../test/platform/PasskeySDK.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jest setup file for core package tests
|
|
3
|
+
*/
|
|
4
|
+
/// <reference types="jest" />
|
|
5
|
+
declare const localStorageMock: {
|
|
6
|
+
getItem: jest.Mock<any, any, any>;
|
|
7
|
+
setItem: jest.Mock<any, any, any>;
|
|
8
|
+
removeItem: jest.Mock<any, any, any>;
|
|
9
|
+
clear: jest.Mock<any, any, any>;
|
|
10
|
+
length: number;
|
|
11
|
+
key: jest.Mock<any, any, any>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../test/setup.ts"],"names":[],"mappings":"AAAA;;GAEG;;AA6BH,QAAA,MAAM,gBAAgB;;;;;;;CAOrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserStorageProvider.test.d.ts","sourceRoot":"","sources":["../../../test/storage/BrowserStorageProvider.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@passkeyme/auth",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "PasskeyMe Authentication SDK - Simpler than Firebase Auth",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rollup -c",
|
|
10
|
+
"dev": "rollup -c -w",
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"lint": "echo 'Linting skipped - TypeScript handled by tsc' || true",
|
|
13
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
14
|
+
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
15
|
+
"prepublishOnly": "npm run build && npm run test && npm run format:check",
|
|
16
|
+
"prepack": "npm run build",
|
|
17
|
+
"postpack": "echo 'Package created successfully'",
|
|
18
|
+
"version": "npm run format && git add -A",
|
|
19
|
+
"postversion": "git push && git push --tags"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"authentication",
|
|
23
|
+
"passkeys",
|
|
24
|
+
"webauthn",
|
|
25
|
+
"oauth",
|
|
26
|
+
"jwt",
|
|
27
|
+
"auth",
|
|
28
|
+
"sdk"
|
|
29
|
+
],
|
|
30
|
+
"author": "PasskeyMe",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"CHANGELOG.md"
|
|
37
|
+
],
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
40
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
41
|
+
"@types/jest": "^29.0.0",
|
|
42
|
+
"eslint": "^8.0.0",
|
|
43
|
+
"jest": "^29.0.0",
|
|
44
|
+
"jest-environment-jsdom": "^30.0.4",
|
|
45
|
+
"prettier": "^3.6.2",
|
|
46
|
+
"rollup": "^3.0.0",
|
|
47
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
48
|
+
"size-limit": "^11.2.0",
|
|
49
|
+
"ts-jest": "^29.0.0",
|
|
50
|
+
"typescript": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"axios": "^1.10.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react-native": ">=0.60.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"react-native": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/passkeyme/passkeyme.git",
|
|
66
|
+
"directory": "sdk/core"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://passkeyme.com",
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/passkeyme/passkeyme/issues"
|
|
71
|
+
}
|
|
72
|
+
}
|