passkeys-prf-client
Version:
A client npm package for passkeys authentication with PRF functionality
142 lines (118 loc) • 2.77 kB
TypeScript
import {PasskeysAuthError} from './passkeys-prf-client';
export declare type ErrorWithMessage = {
message: string;
};
export declare type TokenPrfResponse = {
token: string;
prfKey: string | null;
passkeyCredentialId: string;
};
export declare interface Config {
apiUrl: string;
apiKey: string;
origin: string;
rpid: string;
backendApiRootUrl: string;
}
export declare type SignupBeginResponse = {
status: string;
token: string;
userId: string;
};
export declare type SignupErrorResponse = {
status: string;
token: string;
userId: string;
};
export declare type SignupCompleteResponse = {
status: string;
auth_token: string;
};
export declare type PasskeysAuthResult = {
isPrfSupported?: boolean;
prfKey?: string | null;
authToken?: string;
passkeyCredentialId?: string;
username: string;
};
export declare type PasskeysReAuthResult = {
isPrfSupported?: boolean;
prfKey?: string | null;
verifyToken?: string;
passkeyCredentialId?: string;
};
export declare type PasskeysRegisterResult = {
isPrfSupported?: boolean;
prfKey?: string | null;
passkeyCredentialId?: string;
};
export declare type Error<T> = {
[P in keyof T]?: undefined;
} & {error: PasskeysAuthError};
export declare type PromiseResult<T> = Promise<Result<T>>;
export declare type RegisterBeginResponse = {
session: string;
data: PublicKeyCredentialCreationOptions;
};
export declare type Result<T> = Success<T> | Error<T>;
export declare type SigninBeginResponse = {
data: PublicKeyCredentialRequestOptions;
session: string;
};
export declare type SigninMethod =
| {
userId: string;
}
| {
alias: string;
}
| {
autofill: boolean;
}
| {
discoverable: boolean;
};
export declare type PasskeyDescriptor = {
type: string;
id: string;
};
export declare type PasskeyCredential = {
descriptor: PasskeyDescriptor;
publicKey: string;
userHandle: string;
signatureCounter: number;
createdAt: string;
aaGuid: string;
lastUsedAt: string;
rpid: string;
origin: string;
country: string;
device: string;
nickname: string;
userId: string;
};
export declare type GetUserPasskeyCredentialsBackendResponse = {
success: string;
credentials: PasskeyCredential[];
message?: string;
};
export declare type GetUserPasskeyCredentialsResult = {
credentials?: PasskeyCredential[];
};
export declare type DeleteUserPasskeyCredentialResult = {
isDeletionSuccessful?: boolean;
};
export declare type Success<T> = {
[P in keyof T]: T[P];
} & {
error: undefined;
};
export declare type VerifyReAuthResponse = {
status: string;
verifyToken: string;
};
export declare type VerifyAuthResponse = {
status: string;
authToken: string;
username: string;
};