---
title: "usePasskeys"
description: "usePasskeys, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-passkeys"
---
# usePasskeys

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### UsePasskeysOptions

Defined in: [src/runtime/vue/composables/use-passkeys.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="immediate">
        
      </a>
      
       <code>
        immediate?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Load the passkey list on mount. Default <code>
        true
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UsePasskeysReturn

Defined in: [src/runtime/vue/composables/use-passkeys.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="passkeys">
        
      </a>
      
       <code>
        passkeys
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#passkey">
        <code>
          Passkey
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The user's passkeys — <code>
        undefined
      </code>
      
       until the first (client-only) load lands, and after a failed one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while the list loads.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ispending">
        
      </a>
      
       <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while <code>
        add
      </code>
      
      , <code>
        rename
      </code>
      
       or <code>
        remove
      </code>
      
       runs.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the last action failed, else why the list could not be loaded, else <code>
        null
      </code>
      
      . An action clears its own failure when the next one starts, and signing out clears it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refresh">
        
      </a>
      
       <code>
        refresh
      </code>
    </td>
    
    <td>
      () => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Reload the list. A load never rejects: a failed one shows in <code>
        error
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="add">
        
      </a>
      
       <code>
        add
      </code>
    </td>
    
    <td>
      (<code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#passkey">
        <code>
          Passkey
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Save a passkey on this device, then reload. Resolves with the passkey; rejects on failure, a cancelled prompt included.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rename">
        
      </a>
      
       <code>
        rename
      </code>
    </td>
    
    <td>
      (<code>
        id
      </code>
      
      , <code>
        name
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Rename a passkey, then reload. Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="remove">
        
      </a>
      
       <code>
        remove
      </code>
    </td>
    
    <td>
      (<code>
        id
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Remove a passkey, then reload. Rejects on failure; the last passkey of a passkey-only account is refused (<code>
        invalid_input
      </code>
      
       on <code>
        passkeys
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="capabilities">
        
      </a>
      
       <code>
        capabilities
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#passkeycapabilities">
        <code>
          PasskeyCapabilities
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      What the browser's <code>
        getClientCapabilities()
      </code>
      
       reported (<code>
        conditionalGet
      </code>
      
      , <code>
        hybridTransport
      </code>
      
      , <code>
        passkeyPlatformAuthenticator
      </code>
      
      , …), or <code>
        null
      </code>
      
       before it answers, on the server, and in a browser without it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passkeyonly">
        
      </a>
      
       <code>
        passkeyOnly
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while the account refuses sign-in codes and signs in with passkeys only.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="setpasskeyonly">
        
      </a>
      
       <code>
        setPasskeyOnly
      </code>
    </td>
    
    <td>
      (<code>
        on
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <{ <code>
        recoveryCode
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }>
    </td>
    
    <td>
      Turn sign-in codes off for the account (<code>
        true
      </code>
      
      ) or on again (<code>
        false
      </code>
      
      ). Takes a recent sign-in and refuses an administrator's visit. Turning it on needs a passkey and resolves with <code>
        { recoveryCode }
      </code>
      
      , shown once; turning it on again issues a new code, and the old one stops working. Turning it off resolves with <code>
        { recoveryCode: null }
      </code>
      
      . Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts" rel="nofollow">
        src/runtime/vue/composables/use-passkeys.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### Passkey

Defined in: [src/runtime/vue/utils/auth-session.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts)

A registered passkey, as `registerPasskey` and `usePasskeys` hand it back (loose — the full shape is Better Auth's).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="credentialid">
        
      </a>
      
       <code>
        credentialID?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The WebAuthn credential id, base64url: what the browser knows the passkey by.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name">
        
      </a>
      
       <code>
        name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="devicetype">
        
      </a>
      
       <code>
        deviceType?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="backedup">
        
      </a>
      
       <code>
        backedUp?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createdat">
        
      </a>
      
       <code>
        createdAt
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RegisterPasskeyOptions

Defined in: [src/runtime/vue/utils/auth-session.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts)

How `registerPasskey` saves a passkey: Better Auth's own `addPasskey` options.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-1">
        
      </a>
      
       <code>
        name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The name the passkey is listed under.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="authenticatorattachment">
        
      </a>
      
       <code>
        authenticatorAttachment?
      </code>
    </td>
    
    <td>
      <code>
        "platform"
      </code>
      
       | <code>
        "cross-platform"
      </code>
    </td>
    
    <td>
      Where the passkey may live: this device (<code>
        platform
      </code>
      
      ), a security key (<code>
        cross-platform
      </code>
      
      ), or either (left out).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="useautoregister">
        
      </a>
      
       <code>
        useAutoRegister?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Try to save one silently, with the password manager the person just signed in with.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="extensions">
        
      </a>
      
       <code>
        extensions?
      </code>
    </td>
    
    <td>
      <code>
        AuthenticationExtensionsClientInputs
      </code>
    </td>
    
    <td>
      WebAuthn extensions for the ceremony.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="context">
        
      </a>
      
       <code>
        context?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      Context for a passkey-first registration flow.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/auth-session.ts" rel="nofollow">
        src/runtime/vue/utils/auth-session.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### PasskeyCapabilities

```ts
type PasskeyCapabilities = Record<string, boolean>;
```

Defined in: [src/runtime/vue/utils/passkey-signals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/utils/passkey-signals.ts)

What `PublicKeyCredential.getClientCapabilities()` reports, by the browser's own keys.

## Functions

### usePasskeys()

```ts
function usePasskeys(options?): UsePasskeysReturn;
```

Defined in: [src/runtime/vue/composables/use-passkeys.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-passkeys.ts)

Passkey management over the auth client — list, register, rename, remove.
Loading the list is a read: it never rejects, and a failed load shows in
`error`. The actions resolve, or reject with an `Error` carrying the
server's message (the client's error as its `cause`), and keep the
failure in `error`. The list only loads in the browser (WebAuthn and
the session cookie live there), starting as `undefined` during SSR.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#usepasskeysoptions">
        <code>
          UsePasskeysOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UsePasskeysReturn`](#usepasskeysreturn)

#### Example

```vue
<script setup lang="ts">
const { passkeys, add, remove, isPending, error } = usePasskeys()
</script>
<template>
  <p v-if="error">{{ error.message }}</p>
  <ul>
    <li v-for="passkey in passkeys" :key="passkey.id">
      {{ passkey.name ?? 'Unnamed passkey' }}
      <button :aria-disabled="isPending || undefined" @click="isPending || remove(passkey.id)">Remove</button>
    </li>
  </ul>
  <button :aria-disabled="isPending || undefined" @click="isPending || add()">Add a passkey</button>
</template>
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
