@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
46 lines (45 loc) • 1.51 kB
TypeScript
import { Page } from "@playwright/test";
export interface VirtualAuthenticatorOptions {
protocol?: "ctap2" | "u2f";
transport?: "usb" | "nfc" | "ble" | "internal";
hasResidentKey?: boolean;
hasUserVerification?: boolean;
isUserVerified?: boolean;
automaticPresenceSimulation?: boolean;
}
export interface WebAuthnCredential {
credentialId: string;
isResidentCredential: boolean;
rpId: string;
privateKey: string;
userHandle: string;
signCount: number;
}
export interface WebAuthnCredentialAddedEvent {
authenticatorId: string;
credential: {
credentialId: string;
isResidentCredential: boolean;
rpId?: string;
privateKey: string;
userHandle?: string;
signCount: number;
};
}
export declare class PasskeyAuthenticator {
private authenticatorId?;
private cdpSession?;
private isInitialized;
private page;
constructor(page: Page);
/**
* Set a new Playwright Page for this authenticator and re-create the CDPSession.
* This allows reusing the authenticator across different popups/pages.
*/
setPage(page: Page): Promise<void>;
initialize(options?: VirtualAuthenticatorOptions): Promise<void>;
simulateSuccessfulPasskeyInput(operationTrigger: () => Promise<void>): Promise<void>;
getCredentials(): Promise<WebAuthnCredential[]>;
exportCredentials(): Promise<WebAuthnCredential[]>;
importCredential(cred: WebAuthnCredential): Promise<void>;
}