@ecauth/auth-js
v0.1.3
Published
EcAuth client-side authentication library (WebAuthn, PKCE)
Readme
@ecauth/auth-js
EcAuth client-side authentication library (WebAuthn, PKCE).
Installation
npm install @ecauth/auth-jsUsage
ESM
import { webauthn } from '@ecauth/auth-js';
// Authenticate with passkey
const result = await webauthn.authenticate({
optionsUrl: '/b2b/passkey/authenticate/options',
verifyUrl: '/b2b/passkey/authenticate/verify',
csrfToken: 'your-csrf-token',
});
// Register a passkey
const regResult = await webauthn.register({
optionsUrl: '/b2b/passkey/register/options',
verifyUrl: '/b2b/passkey/register/verify',
b2bSubject: 'user-uuid',
csrfToken: 'your-csrf-token',
});UMD (script tag)
<script src="ecauth-auth.umd.js"></script>
<script>
EcAuth.webauthn.authenticate({
optionsUrl: '/b2b/passkey/authenticate/options',
verifyUrl: '/b2b/passkey/authenticate/verify',
csrfToken: 'your-csrf-token',
});
</script>License
LGPL-2.1-or-later
