> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dfns.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Development

> Signers and classes for the browser Dfns TypeScript SDK, including WebAuthn passkey support, login flows, and request signing patterns.

## WebAuthnSigner

`WebAuthnSigner` is the recommended signer for browser applications. The private key never leaves the authenticator and is never available to the browser.

```ts theme={null}
import { WebAuthnSigner } from '@dfns/sdk-browser'

const webauthn = new WebAuthnSigner({
  relyingParty: { id: 'acme.com', name: 'Acme' },
})
```

## BrowserKeySigner

`BrowserKeySigner` signs using a `CryptoKeyPair` in the browser. Use this only when WebAuthn is not available — the private key lives in browser memory, so you need a secure way to load it.

```ts theme={null}
import { BrowserKeySigner } from '@dfns/sdk-browser'

const browserKey = new BrowserKeySigner({
  keyPair: keyPair, // CryptoKeyPair — protect and load securely
})

const attestation = await browserKey.create(challenge)
const assertion = await browserKey.sign(challenge)
```

## DfnsAuthenticator

`DfnsAuthenticator` handles user login flows in the browser. It prompts for WebAuthn credentials and returns an auth token.

```ts theme={null}
import { DfnsAuthenticator } from '@dfns/sdk'
import { WebAuthn } from '@dfns/sdk-browser'

const dfnsAuth = new DfnsAuthenticator({
  orgId,
  baseUrl: apiUrl,
  signer: new WebAuthn({ rpId }),
})

// Prompts for biometrics / security key
const { token } = await dfnsAuth.login({ orgId, username })
```
