@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,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client for PasskeyMe authentication services
|
|
3
|
+
*/
|
|
4
|
+
import { AuthTokens, User, AppConfiguration } from "./types";
|
|
5
|
+
export declare class PasskeymeApiClient {
|
|
6
|
+
private baseUrl;
|
|
7
|
+
private appId;
|
|
8
|
+
private debug;
|
|
9
|
+
constructor(appId: string, baseUrl?: string, debug?: boolean);
|
|
10
|
+
private log;
|
|
11
|
+
private request;
|
|
12
|
+
/**
|
|
13
|
+
* Get authentication configuration for the app
|
|
14
|
+
*/
|
|
15
|
+
getConfig(): Promise<AppConfiguration>;
|
|
16
|
+
/**
|
|
17
|
+
* Start OAuth authentication flow
|
|
18
|
+
*/
|
|
19
|
+
startOAuth(provider: string, redirectUri: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Start passkey authentication
|
|
22
|
+
*/
|
|
23
|
+
startPasskeyAuth(username?: string): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Complete passkey authentication
|
|
26
|
+
*/
|
|
27
|
+
completePasskeyAuth(credential: string, redirectUri?: string): Promise<AuthTokens>;
|
|
28
|
+
/**
|
|
29
|
+
* Login with username/password
|
|
30
|
+
*/
|
|
31
|
+
loginWithPassword(username: string, password: string, redirectUri?: string): Promise<AuthTokens>;
|
|
32
|
+
/**
|
|
33
|
+
* Handle OAuth callback
|
|
34
|
+
*/
|
|
35
|
+
handleOAuthCallback(code: string, state: string): Promise<AuthTokens>;
|
|
36
|
+
/**
|
|
37
|
+
* Verify and decode JWT token
|
|
38
|
+
*/
|
|
39
|
+
verifyToken(token: string): Promise<User>;
|
|
40
|
+
/**
|
|
41
|
+
* Refresh access token
|
|
42
|
+
*/
|
|
43
|
+
refreshToken(refreshToken: string): Promise<AuthTokens>;
|
|
44
|
+
/**
|
|
45
|
+
* Get JWKS for token verification
|
|
46
|
+
*/
|
|
47
|
+
getJWKS(): Promise<any>;
|
|
48
|
+
/**
|
|
49
|
+
* Exchange authorization code for tokens (hosted auth callback)
|
|
50
|
+
*/
|
|
51
|
+
exchangeCodeForTokens(code: string, redirectUri: string): Promise<{
|
|
52
|
+
tokens: AuthTokens;
|
|
53
|
+
user: User;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/api-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAY,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGvE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAU;gBAGrB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAqC,EAC9C,KAAK,GAAE,OAAe;IAOxB,OAAO,CAAC,GAAG;YAMG,OAAO;IAwDrB;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAiD5C;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQxE;;OAEG;IACG,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAOvD;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,UAAU,CAAC;IAOtB;;OAEG;IACG,iBAAiB,CACrB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,UAAU,CAAC;IAWtB;;OAEG;IACG,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAO3E;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C/C;;OAEG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAO7D;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAI7B;;OAEG;IACG,qBAAqB,CACzB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;CAe/C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Error Handling for PasskeyMe SDK
|
|
3
|
+
*/
|
|
4
|
+
export declare enum PasskeymeErrorCode {
|
|
5
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
6
|
+
API_ERROR = "API_ERROR",
|
|
7
|
+
SERVER_ERROR = "SERVER_ERROR",
|
|
8
|
+
AUTH_FAILED = "AUTH_FAILED",
|
|
9
|
+
INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
|
|
10
|
+
SESSION_EXPIRED = "SESSION_EXPIRED",
|
|
11
|
+
PASSKEY_NOT_SUPPORTED = "PASSKEY_NOT_SUPPORTED",
|
|
12
|
+
PASSKEY_CREATION_FAILED = "PASSKEY_CREATION_FAILED",
|
|
13
|
+
PASSKEY_AUTH_FAILED = "PASSKEY_AUTH_FAILED",
|
|
14
|
+
PASSKEY_CANCELLED = "PASSKEY_CANCELLED",
|
|
15
|
+
INVALID_CONFIG = "INVALID_CONFIG",
|
|
16
|
+
API_KEY_INVALID = "API_KEY_INVALID",
|
|
17
|
+
APP_ID_INVALID = "APP_ID_INVALID",
|
|
18
|
+
USER_CANCELLED = "USER_CANCELLED",
|
|
19
|
+
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
20
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
21
|
+
}
|
|
22
|
+
export interface PasskeymeErrorDetails {
|
|
23
|
+
code: PasskeymeErrorCode;
|
|
24
|
+
message: string;
|
|
25
|
+
userMessage: string;
|
|
26
|
+
recoverable: boolean;
|
|
27
|
+
retryable: boolean;
|
|
28
|
+
technicalDetails?: any;
|
|
29
|
+
suggestedAction?: string;
|
|
30
|
+
helpUrl?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class PasskeymeError extends Error {
|
|
33
|
+
readonly code: PasskeymeErrorCode;
|
|
34
|
+
readonly userMessage: string;
|
|
35
|
+
readonly recoverable: boolean;
|
|
36
|
+
readonly retryable: boolean;
|
|
37
|
+
readonly technicalDetails?: any;
|
|
38
|
+
readonly suggestedAction?: string;
|
|
39
|
+
readonly helpUrl?: string;
|
|
40
|
+
constructor(details: PasskeymeErrorDetails);
|
|
41
|
+
static fromError(error: any): PasskeymeError;
|
|
42
|
+
toJSON(): {
|
|
43
|
+
name: string;
|
|
44
|
+
code: PasskeymeErrorCode;
|
|
45
|
+
message: string;
|
|
46
|
+
userMessage: string;
|
|
47
|
+
recoverable: boolean;
|
|
48
|
+
retryable: boolean;
|
|
49
|
+
suggestedAction: string | undefined;
|
|
50
|
+
helpUrl: string | undefined;
|
|
51
|
+
stack: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Error handler utility for consistent error processing
|
|
56
|
+
*/
|
|
57
|
+
export declare class ErrorHandler {
|
|
58
|
+
private static logError;
|
|
59
|
+
static handle(error: any, context?: string): PasskeymeError;
|
|
60
|
+
}
|
|
61
|
+
//# sour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;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ;WAgBT,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc;CAKnE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP interceptors for automatic token management
|
|
3
|
+
*/
|
|
4
|
+
import { PasskeymeAuth } from "./passkeyme-auth";
|
|
5
|
+
import { HttpInterceptorConfig } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a fetch wrapper that automatically adds authentication headers
|
|
8
|
+
*/
|
|
9
|
+
export declare function createAuthenticatedFetch(auth: PasskeymeAuth, config?: HttpInterceptorConfig): typeof fetch;
|
|
10
|
+
/**
|
|
11
|
+
* Axios interceptor for automatic token management
|
|
12
|
+
*/
|
|
13
|
+
export declare function createAxiosInterceptor(auth: PasskeymeAuth, config?: HttpInterceptorConfig): {
|
|
14
|
+
request: (requestConfig: any) => Promise<any>;
|
|
15
|
+
response: {
|
|
16
|
+
success: (response: any) => any;
|
|
17
|
+
error: (error: any) => Promise<any>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Setup automatic token management for a popular HTTP client
|
|
22
|
+
*/
|
|
23
|
+
export declare function setupHttpInterceptor(auth: PasskeymeAuth, client: any, config?: HttpInterceptorConfig): () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Utility to manually add auth header to any request
|
|
26
|
+
*/
|
|
27
|
+
export declare function addAuthHeader(auth: PasskeymeAuth, headers?: Record<string, string>, headerName?: string, tokenPrefix?: string): Promise<Record<string, string>>;
|
|
28
|
+
//# sourceMappingURL=http-interceptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-interceptors.d.ts","sourceRoot":"","sources":["../../src/http-interceptors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGhD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,aAAa,EACnB,MAAM,GAAE,qBAA0B,GACjC,OAAO,KAAK,CAsDd;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,EACnB,MAAM,GAAE,qBAA0B;6BAUD,GAAG;;4BAqBZ,GAAG;uBAEF,GAAG;;EAmC7B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,GAAG,EACX,MAAM,GAAE,qBAA0B,GACjC,MAAM,IAAI,CAwCZ;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACpC,UAAU,GAAE,MAAwB,EACpC,WAAW,GAAE,MAAkB,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAejC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PasskeyMe Authentication SDK
|
|
3
|
+
*
|
|
4
|
+
* A simple, Firebase Auth-like SDK for authentication with PasskeyMe.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { PasskeymeAuth } from '@passkeyme/auth';
|
|
9
|
+
*
|
|
10
|
+
* const auth = new PasskeymeAuth({
|
|
11
|
+
* appId: 'your-app-id',
|
|
12
|
+
* redirectUri: 'http://localhost:3000/auth/callback'
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Initialize the SDK
|
|
16
|
+
* await auth.init();
|
|
17
|
+
*
|
|
18
|
+
* // Login with OAuth
|
|
19
|
+
* await auth.loginWithOAuth('google');
|
|
20
|
+
*
|
|
21
|
+
* // Login with passkey
|
|
22
|
+
* const user = await auth.loginWithPasskey();
|
|
23
|
+
*
|
|
24
|
+
* // Get current user
|
|
25
|
+
* const currentUser = auth.getCurrentUser();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export { PasskeymeAuth } from "./passkeyme-auth";
|
|
29
|
+
export { PasskeymeApiClient } from "./api-client";
|
|
30
|
+
export { TokenStorage } from "./token-storage";
|
|
31
|
+
export type { StorageProvider } from "./storage";
|
|
32
|
+
export { BrowserStorageProvider } from "./storage";
|
|
33
|
+
export type { PasskeySDK, PasskeyRegistrationOptions, PasskeyAuthenticationOptions, PasskeyRegistrationResult, PasskeyAuthenticationResult, AuthenticatorInfo, } from "./platform";
|
|
34
|
+
export { NoOpPasskeySDK, WebPasskeySDK, ReactNativePasskeySDK, } from "./platform";
|
|
35
|
+
export { createAuthenticatedFetch, createAxiosInterceptor, setupHttpInterceptor, addAuthHeader, } from "./http-interceptors";
|
|
36
|
+
export type { PasskeymeConfig, User, AuthTokens, AuthState, LoginOptions, AuthEvent, AuthEventListener, PasskeymeAuthInstance, HttpInterceptorConfig, ApiError, AppConfiguration, } from "./types";
|
|
37
|
+
import { PasskeymeAuth } from "./passkeyme-auth";
|
|
38
|
+
import type { PasskeymeConfig } from "./types";
|
|
39
|
+
export default PasskeymeAuth;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new PasskeyMe Auth instance
|
|
42
|
+
*
|
|
43
|
+
* @param config - Configuration options
|
|
44
|
+
* @returns PasskeymeAuth instance
|
|
45
|
+
*/
|
|
46
|
+
export declare function createAuth(config: PasskeymeConfig): PasskeymeAuth;
|
|
47
|
+
export { PasskeymeError, PasskeymeErrorCode, ErrorHandler, type PasskeymeErrorDetails, } from "./errors";
|
|
48
|
+
export { Logger, logger } from "./utils/logger";
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;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fig, User, AuthState, LoginOptions, AuthEventListener, AuthStateListener, PasskeymeAuthInstance, AppConfiguration } from "./types";
|
|
5
|
+
import { PasskeymeApiClient } from "./api-client";
|
|
6
|
+
export declare class PasskeymeAuth implements PasskeymeAuthInstance {
|
|
7
|
+
private config;
|
|
8
|
+
readonly apiClient: PasskeymeApiClient;
|
|
9
|
+
private tokenStorage;
|
|
10
|
+
private storage;
|
|
11
|
+
private passkeySDK;
|
|
12
|
+
private eventListeners;
|
|
13
|
+
private stateListeners;
|
|
14
|
+
private _appConfig;
|
|
15
|
+
private _appConfigPromise;
|
|
16
|
+
private _state;
|
|
17
|
+
constructor(config: PasskeymeConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Create default passkey SDK based on environment
|
|
20
|
+
*/
|
|
21
|
+
private createDefaultPasskeySDK;
|
|
22
|
+
/**
|
|
23
|
+
* Try to import web SDK - will be overridden by platform-specific packages
|
|
24
|
+
*/
|
|
25
|
+
private tryImportWebSDK;
|
|
26
|
+
get state(): AuthState;
|
|
27
|
+
private setState;
|
|
28
|
+
private notifyStateListeners;
|
|
29
|
+
private emitEvent;
|
|
30
|
+
private verifyStoredToken;
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the SDK - call this once when your app starts
|
|
33
|
+
*/
|
|
34
|
+
init(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Redirect to hosted authentication page
|
|
37
|
+
* This shows your branded auth page with all configured authentication options
|
|
38
|
+
*/
|
|
39
|
+
redirectToLogin(options?: LoginOptions): void;
|
|
40
|
+
/**
|
|
41
|
+
* Redirect directly to OAuth provider (bypasses hosted auth page)
|
|
42
|
+
* This skips the hosted auth page and goes straight to the OAuth provider
|
|
43
|
+
*/
|
|
44
|
+
redirectToOAuth(provider: "google" | "github" | "facebook", redirectUri?: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Internal method to perform the actual redirect and store state
|
|
47
|
+
*/
|
|
48
|
+
private performRedirect;
|
|
49
|
+
/**
|
|
50
|
+
* Handle authentication callback from hosted auth page
|
|
51
|
+
*/
|
|
52
|
+
handleAuthCallback(): Promise<User>;
|
|
53
|
+
/**
|
|
54
|
+
* Legacy method name for handleAuthCallback
|
|
55
|
+
*/
|
|
56
|
+
handleCallback(): Promise<User>;
|
|
57
|
+
/**
|
|
58
|
+
* Logout current user
|
|
59
|
+
*/
|
|
60
|
+
logout(): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Get current user
|
|
63
|
+
*/
|
|
64
|
+
getCurrentUser(): User | null;
|
|
65
|
+
/**
|
|
66
|
+
* Get current access token
|
|
67
|
+
*/
|
|
68
|
+
getAccessToken(): Promise<string | null>;
|
|
69
|
+
/**
|
|
70
|
+
* Refresh access token
|
|
71
|
+
*/
|
|
72
|
+
refreshToken(): Promise<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Add event listener
|
|
75
|
+
*/
|
|
76
|
+
addEventListener(listener: AuthEventListener): () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Remove event listener
|
|
79
|
+
*/
|
|
80
|
+
removeEventListener(listener: AuthEventListener): void;
|
|
81
|
+
/**
|
|
82
|
+
* Subscribe to state changes
|
|
83
|
+
* @param listener - Function to call when state changes
|
|
84
|
+
* @returns Unsubscribe function
|
|
85
|
+
*/
|
|
86
|
+
subscribe(listener: AuthStateListener): () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Get current authentication state
|
|
89
|
+
* @returns Current state object
|
|
90
|
+
*/
|
|
91
|
+
getState(): AuthState;
|
|
92
|
+
/**
|
|
93
|
+
* Handle direct token authentication callback
|
|
94
|
+
* Use this when your backend sends tokens directly instead of authorization codes
|
|
95
|
+
*/
|
|
96
|
+
handleTokenCallback(token: string): Promise<User>;
|
|
97
|
+
/**
|
|
98
|
+
* Get the base URL configured for this auth instance
|
|
99
|
+
*/
|
|
100
|
+
getBaseUrl(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Get the app ID configured for this auth instance
|
|
103
|
+
*/
|
|
104
|
+
getAppId(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Check if passkeys are supported on this device
|
|
107
|
+
*/
|
|
108
|
+
isPasskeySupported(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Check if user has registered passkeys (stored locally)
|
|
111
|
+
*/
|
|
112
|
+
hasStoredPasskeys(username?: string): Promise<boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* Store passkey availability for a user (called after successful registration)
|
|
115
|
+
*/
|
|
116
|
+
setPasskeyAvailable(username: string, available?: boolean): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Store username for future smart login attempts
|
|
119
|
+
*/
|
|
120
|
+
storeUsername(username: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Authenticate user with passkey (supports discoverable credentials)
|
|
123
|
+
*/
|
|
124
|
+
passkeyLogin(username: string | undefined, apiKey: string): Promise<User>;
|
|
125
|
+
/**
|
|
126
|
+
* Smart passkey authentication with industry-standard flow:
|
|
127
|
+
* 1. Check app config for discoverable credentials support
|
|
128
|
+
* 2. If supported: attempt discoverable credentials first (no username)
|
|
129
|
+
* 3. If not supported or fails: use stored username or prompt for username
|
|
130
|
+
* 4. Fallback to hosted auth if all passkey attempts fail
|
|
131
|
+
*/
|
|
132
|
+
smartLogin(username?: string, apiKey?: string): Promise<{
|
|
133
|
+
method: "passkey" | "redirect";
|
|
134
|
+
user?: User;
|
|
135
|
+
}>;
|
|
136
|
+
/**
|
|
137
|
+
* Get the effective passkey API key (supports both new and legacy config)
|
|
138
|
+
*/
|
|
139
|
+
private getPasskeyApiKey;
|
|
140
|
+
/**
|
|
141
|
+
* Get the effective auto prompt registration setting (supports both new and legacy config)
|
|
142
|
+
*/
|
|
143
|
+
private getAutoPromptPasskeyRegistration;
|
|
144
|
+
/**
|
|
145
|
+
* Get the effective enable passkey login setting (supports both new and legacy config)
|
|
146
|
+
*/
|
|
147
|
+
private getEnablePasskeyLogin;
|
|
148
|
+
/**
|
|
149
|
+
* Get the effective passkey registration prompt message (supports both new and legacy config)
|
|
150
|
+
*/
|
|
151
|
+
private getPasskeyRegistrationPrompt;
|
|
152
|
+
/**
|
|
153
|
+
* Get the app configuration (cached)
|
|
154
|
+
*/
|
|
155
|
+
getAppConfig(): Promise<AppConfiguration>;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=passkeyme-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkeyme-auth.d.ts","sourceRoot":"","sources":["../../src/passkeyme-auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,IAAI,EAEJ,SAAS,EACT,YAAY,EAEZ,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EAErB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,qBAAa,aAAc,YAAW,qBAAqB;IACzD,OAAO,CAAC,MAAM,CAKZ;IACF,SAAgB,SAAS,EAAE,kBAAkB,CAAC;IAC9C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,iBAAiB,CAA0C;IACnE,OAAO,CAAC,MAAM,CAKZ;gBAEU,MAAM,EAAE,eAAe;IAqCnC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyB/B;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB,IAAI,KAAK,IAAI,SAAS,CAErB;IAED,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,SAAS;YAUH,iBAAiB;IAuB/B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C3B;;;OAGG;IACH,eAAe,CAAC,OAAO,GAAE,YAAiB,GA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AI,CAAC;IAKpD;;OAEG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAoMhB;;;;;;OAMG;IACG,UAAU,CACd,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,CAAC;IAuH3D;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAQxC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAOpC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC;CA4BhD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform SDK Interface for PasskeyMe
|
|
3
|
+
*
|
|
4
|
+
* This interface abstracts platform-specific passkey operations,
|
|
5
|
+
* allowing the core SDK to work across web, React Native, and other platforms.
|
|
6
|
+
*/
|
|
7
|
+
export interface PasskeyRegistrationOptions {
|
|
8
|
+
/** Username for the passkey (usually email) */
|
|
9
|
+
username: string;
|
|
10
|
+
/** Display name for the passkey (usually full name) */
|
|
11
|
+
displayName?: string;
|
|
12
|
+
/** Whether to require user verification */
|
|
13
|
+
requireUserVerification?: boolean;
|
|
14
|
+
/** Additional options for the platform */
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export interface PasskeyAuthenticationOptions {
|
|
18
|
+
/** Username hint for the passkey */
|
|
19
|
+
username?: string;
|
|
20
|
+
/** Whether to require user verification */
|
|
21
|
+
requireUserVerification?: boolean;
|
|
22
|
+
/** Additional options for the platform */
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
export interface PasskeyRegistrationResult {
|
|
26
|
+
/** Whether registration was successful */
|
|
27
|
+
success: boolean;
|
|
28
|
+
/** Error message if registration failed */
|
|
29
|
+
error?: string;
|
|
30
|
+
/** Credential ID if registration was successful */
|
|
31
|
+
credentialId?: string;
|
|
32
|
+
/** Platform-specific data */
|
|
33
|
+
data?: any;
|
|
34
|
+
}
|
|
35
|
+
export interface PasskeyAuthenticationResult {
|
|
36
|
+
/** Whether authentication was successful */
|
|
37
|
+
success: boolean;
|
|
38
|
+
/** Error message if authentication failed */
|
|
39
|
+
error?: string;
|
|
40
|
+
/** Assertion data if authentication was successful */
|
|
41
|
+
assertion?: any;
|
|
42
|
+
/** Platform-specific data */
|
|
43
|
+
data?: any;
|
|
44
|
+
}
|
|
45
|
+
export interface AuthenticatorInfo {
|
|
46
|
+
/** Authenticator type */
|
|
47
|
+
type: string;
|
|
48
|
+
/** Whether it supports biometrics */
|
|
49
|
+
supportsBiometrics: boolean;
|
|
50
|
+
/** Whether it supports user verification */
|
|
51
|
+
supportsUserVerification: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Platform SDK Interface
|
|
55
|
+
*
|
|
56
|
+
* Each platform (web, React Native, Capacitor, etc.) implements this interface
|
|
57
|
+
* to provide passkey functionality specific to that platform.
|
|
58
|
+
*/
|
|
59
|
+
export interface PasskeySDK {
|
|
60
|
+
/**
|
|
61
|
+
* Register a new passkey
|
|
62
|
+
* @param options Registration options
|
|
63
|
+
* @returns Promise resolving to registration result
|
|
64
|
+
*/
|
|
65
|
+
register(options: PasskeyRegistrationOptions): Promise<PasskeyRegistrationResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Authenticate with an existing passkey
|
|
68
|
+
* @param options Authentication options
|
|
69
|
+
* @returns Promise resolving to authentication result
|
|
70
|
+
*/
|
|
71
|
+
authenticate(options: PasskeyAuthenticationOptions): Promise<PasskeyAuthenticationResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Check if passkeys are supported on this platform
|
|
74
|
+
* @returns Whether passkeys are supported
|
|
75
|
+
*/
|
|
76
|
+
isSupported(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Get available authenticators on this platform
|
|
79
|
+
* @returns Promise resolving to list of available authenticators
|
|
80
|
+
*/
|
|
81
|
+
getAvailableAuthenticators?(): Promise<AuthenticatorInfo[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Check if discoverable credentials are supported
|
|
84
|
+
* @returns Whether discoverable credentials are supported
|
|
85
|
+
*/
|
|
86
|
+
canUseDiscoverableCredentials?(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Check if biometric authentication is available
|
|
89
|
+
* @returns Whether biometric authentication is available
|
|
90
|
+
*/
|
|
91
|
+
supportsBiometrics?(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Platform-specific initialization
|
|
94
|
+
* @param config Platform-specific configuration
|
|
95
|
+
*/
|
|
96
|
+
initialize?(config: any): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Platform-specific cleanup
|
|
99
|
+
*/
|
|
100
|
+
cleanup?(): Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* No-op implementation for platforms without passkey support
|
|
104
|
+
*/
|
|
105
|
+
export declare class NoOpPasskeySDK implements PasskeySDK {
|
|
106
|
+
register(_options: PasskeyRegistrationOptions): Promise<PasskeyRegistrationResult>;
|
|
107
|
+
authenticate(_options: PasskeyAuthenticationOptions): Promise<PasskeyAuthenticationResult>;
|
|
108
|
+
isSupported(): boolean;
|
|
109
|
+
canUseDiscoverableCredentials(): boolean;
|
|
110
|
+
supportsBiometrics(): boolean;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=PasskeySDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasskeySDK.d.ts","sourceRoot":"","sources":["../../../src/platform/PasskeySDK.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,0BAA0B;IACzC,+CAA+C;IAC/C,QAAQ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AA2B,CAAC,CAAC;IAExC;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;OAGG;IACH,0BAA0B,CAAC,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE5D;;;OAGG;IACH,6BAA6B,CAAC,IAAI,OAAO,CAAC;IAE1C;;;OAGG;IACH,kBAAkB,CAAC,IAAI,OAAO,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;OAEG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,qBAAa,cAAe,YAAW,UAAU;IACzC,QAAQ,CACZ,QAAQ,EAAE,0BAA0B,GACnC,OAAO,CAAC,yBAAyB,CAAC;IAO/B,YAAY,CAChB,QAAQ,EAAE,4BAA4B,GACrC,OAAO,CAAC,2BAA2B,CAAC;IAOvC,WAAW,IAAI,OAAO;IAItB,6BAA6B,IAAI,OAAO;IAIxC,kBAAkB,IAAI,OAAO;CAG9B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native Platform SDK Implementation
|
|
3
|
+
*
|
|
4
|
+
* Bridges to native iOS (CocoaPods) and Android (Gradle) SDKs
|
|
5
|
+
*/
|
|
6
|
+
import type { PasskeySDK, PasskeyRegistrationOptions, PasskeyAuthenticationOptions, PasskeyRegistrationResult, PasskeyAuthenticationResult, AuthenticatorInfo } from "./PasskeySDK";
|
|
7
|
+
/**
|
|
8
|
+
* React Native implementation of PasskeySDK
|
|
9
|
+
*
|
|
10
|
+
* This implementation bridges to native iOS and Android SDKs:
|
|
11
|
+
* - iOS: https://cocoapods.org/pods/PasskeymeSDK
|
|
12
|
+
* - Android: https://maven.pkg.github.com/justincrosbie/passkeyme-android-sdk
|
|
13
|
+
*/
|
|
14
|
+
export declare class ReactNativePasskeySDK implements PasskeySDK {
|
|
15
|
+
private nativeModule;
|
|
16
|
+
constructor();
|
|
17
|
+
register(options: PasskeyRegistrationOptions): Promise<PasskeyRegistrationResult>;
|
|
18
|
+
authenticate(options: PasskeyAuthenticationOptions): Promise<PasskeyAuthenticationResult>;
|
|
19
|
+
isSupported(): boolean;
|
|
20
|
+
getAvailableAuthenticators(): Promise<AuthenticatorInfo[]>;
|
|
21
|
+
canUseDiscoverableCredentials(): boolean;
|
|
22
|
+
supportsBiometrics(): boolean;
|
|
23
|
+
initialize(config?: any): Promise<void>;
|
|
24
|
+
cleanup(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if the device supports Face ID (iOS) or Face Unlock (Android)
|
|
27
|
+
*/
|
|
28
|
+
supportsFaceRecognition(): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if the device supports Touch ID (iOS) or Fingerprint (Android)
|
|
31
|
+
*/
|
|
32
|
+
supportsFingerprint(): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Get detailed biometric capabilities
|
|
35
|
+
*/
|
|
36
|
+
getBiometricCapabilities(): Promise<{
|
|
37
|
+
faceRecognition: boolean;
|
|
38
|
+
fingerprint: boolean;
|
|
39
|
+
voiceRecognition: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ReactNativePasskeySDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativePasskeySDK.d.ts","sourceRoot":"","sources":["../../../src/platform/ReactNativePasskeySDK.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB;;;;;;GAMG;AACH,qBAAa,qBAAsB,YAAW,UAAU;IACtD,OAAO,CAAC,YAAY,CAAM;;IAepB,QAAQ,CACZ,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,yBAAyB,CAAC;IA6B/B,YAAY,CAChB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC;IA6BvC,WAAW,IAAI,OAAO;IAIhB,0BAA0B,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAgBhE,6BAA6B,IAAI,OAAO;IAKxC,kBAAkB,IAAI,OAAO;IAKvB,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IASvC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAM9B;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IASjD;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAS7C;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC;QACxC,eAAe,EAAE,OAAO,CAAC;QACzB,WAAW,EAAE,OAAO,CAAC;QACrB,gBAAgB,EAAE,OAAO,CAAC;KAC3B,CAAC;CAkBH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Platform SDK Implementation
|
|
3
|
+
*
|
|
4
|
+
* Wraps the passkeyme-web-sdk to implement the PasskeySDK interface
|
|
5
|
+
*/
|
|
6
|
+
import type { PasskeySDK, PasskeyRegistrationOptions, PasskeyAuthenticationOptions, PasskeyRegistrationResult, PasskeyAuthenticationResult, AuthenticatorInfo } from "./PasskeySDK";
|
|
7
|
+
/**
|
|
8
|
+
* Web implementation of PasskeySDK using passkeyme-web-sdk
|
|
9
|
+
*
|
|
10
|
+
* This implementation should be used for web browsers that support WebAuthn.
|
|
11
|
+
* The actual passkeyme-web-sdk dependency should be provided by the consuming package.
|
|
12
|
+
*/
|
|
13
|
+
export declare class WebPasskeySDK implements PasskeySDK {
|
|
14
|
+
private webSDK;
|
|
15
|
+
constructor(webSDK: any);
|
|
16
|
+
register(options: PasskeyRegistrationOptions): Promise<PasskeyRegistrationResult>;
|
|
17
|
+
authenticate(options: PasskeyAuthenticationOptions): Promise<PasskeyAuthenticationResult>;
|
|
18
|
+
isSupported(): boolean;
|
|
19
|
+
getAvailableAuthenticators(): Promise<AuthenticatorInfo[]>;
|
|
20
|
+
canUseDiscoverableCredentials(): boolean;
|
|
21
|
+
supportsBiometrics(): boolean;
|
|
22
|
+
initialize(config?: any): Promise<void>;
|
|
23
|
+
cleanup(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=WebPasskeySDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebPasskeySDK.d.ts","sourceRoot":"","sources":["../../../src/platform/WebPasskeySDK.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,UAAU;IAC9C,OAAO,CAAC,MAAM,CAAM;gBAER,MAAM,EAAE,GAAG;IAIjB,QAAQ,CACZ,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,yBAAyB,CAAC;IAgC/B,YAAY,CAChB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC;IAgCvC,WAAW,IAAI,OAAO;IAUhB,0BAA0B,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAuBhE,6BAA6B,IAAI,OAAO;IAKxC,kBAAkB,IAAI,OAAO;IAWvB,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform SDK exports
|
|
3
|
+
*/
|
|
4
|
+
export type { PasskeySDK, PasskeyRegistrationOptions, PasskeyAuthenticationOptions, PasskeyRegistrationResult, PasskeyAuthenticationResult, AuthenticatorInfo, } from "./PasskeySDK";
|
|
5
|
+
export { NoOpPasskeySDK } from "./PasskeySDK";
|
|
6
|
+
export { WebPasskeySDK } from "./WebPasskeySDK";
|
|
7
|
+
export { ReactNativePasskeySDK } from "./ReactNativePasskeySDK";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,UAAU,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser storage implementation using localStorage or sessionStorage
|
|
3
|
+
*/
|
|
4
|
+
import { StorageProvider } from "./StorageProvider";
|
|
5
|
+
export declare class BrowserStorageProvider implements StorageProvider {
|
|
6
|
+
private storage;
|
|
7
|
+
private keyPrefix;
|
|
8
|
+
constructor(useSessionStorage?: boolean, keyPrefix?: string);
|
|
9
|
+
getItem(key: string): Promise<string | null>;
|
|
10
|
+
setItem(key: string, value: string): Promise<void>;
|
|
11
|
+
removeItem(key: string): Promise<void>;
|
|
12
|
+
clear(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=BrowserStorageProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserStorageProvider.d.ts","sourceRoot":"","sources":["../../../src/storage/BrowserStorageProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,SAAS,CAAS;gBAGxB,iBAAiB,GAAE,OAAe,EAClC,SAAS,GAAE,MAAsB;IAkB7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAU5C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB7B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage abstraction interface for PasskeyMe Auth SDK
|
|
3
|
+
*
|
|
4
|
+
* This interface allows different storage implementations across platforms:
|
|
5
|
+
* - Browser: localStorage/sessionStorage
|
|
6
|
+
* - React Native: AsyncStorage
|
|
7
|
+
* - Node.js: Custom storage implementations
|
|
8
|
+
*/
|
|
9
|
+
export interface StorageProvider {
|
|
10
|
+
/**
|
|
11
|
+
* Get an item from storage
|
|
12
|
+
* @param key - The storage key
|
|
13
|
+
* @returns The stored value or null if not found
|
|
14
|
+
*/
|
|
15
|
+
getItem(key: string): Promise<string | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Set an item in storage
|
|
18
|
+
* @param key - The storage key
|
|
19
|
+
* @param value - The value to store
|
|
20
|
+
*/
|
|
21
|
+
setItem(key: string, value: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Remove an item from storage
|
|
24
|
+
* @param key - The storage key to remove
|
|
25
|
+
*/
|
|
26
|
+
removeItem(key: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Clear all items from storage (optional)
|
|
29
|
+
*/
|
|
30
|
+
clear?(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=StorageProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageProvider.d.ts","sourceRoot":"","sources":["../../../src/storage/StorageProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE7C;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;OAGG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|