@authaction/passkey-plus-sdk v1.0.3
Passkey Plus SDK
A lightweight frontend SDK that enables seamless integration of passkey authentication into your existing authentication solutions, powered by AuthAction (https://authaction.com).
Purpose
This SDK provides a simple interface to add passkey-based authentication to your applications while working alongside your existing authentication systems. It allows you to leverage the security benefits of passkeys without having to completely replace your current authentication infrastructure.
Features
- Simple and intuitive API
- TypeScript support with type definitions
- Modern ES modules and CommonJS support
- Zero dependencies (except for browser WebAuthn API)
- Comprehensive error handling
- Integration with AuthAction's passkey authentication service
Installation
npm install @authaction/passkey-plus-sdkUsage
Initialize the SDK
import { PasskeyPlus } from "@authaction/passkey-plus-sdk";
// Initialize with your AuthAction tenant credentials
const passkeyPlus = new PasskeyPlus({
tenantDomain: "your-tenant.authaction.com",
appId: "your-app-id",
});Register a New Passkey
// Start passkey registration process
await passkeyPlus.register("transaction-id", {
authenticatorAttachment: "platform", // or 'cross-platform'
});Authenticate with Passkey
// Authenticate using an existing passkey
await passkeyPlus.authenticate("transaction-id", {
isConditionalMediation: true,
});Check Passkey Support
// Check if passkey authentication is available
const canAuthenticate = await passkeyPlus.canAuthenticateWithPasskey();
const canRegister = await passkeyPlus.canRegisterPasskey();
const canUseConditionalMediation =
await passkeyPlus.canUseConditionalMediation();Error Handling
The SDK uses standard JavaScript errors. You can catch and handle any errors that occur during passkey operations:
try {
await passkeyPlus.register("transaction-id");
} catch (error) {
// Handle any errors that occur during passkey operations
console.error("Error:", error);
}Browser Support
This SDK works with any modern browser that supports the WebAuthn API. It's compatible with:
- Chrome
- Firefox
- Safari
- Edge
Learn More
For more information about passkeys and AuthAction's authentication solutions, visit AuthAction's website.