Skip to content

KeyManager.http

Manages public key registrations remotely on a server.

Usage

wagmi.config.ts
ts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'

export const config = createConfig({
  connectors: [webAuthn({
    keyManager: KeyManager.http('/keys'), 
  })],
  chains: [tempoTestnet],
  multiInjectedProviderDiscovery: false,
  transports: {
    [tempoTestnet.id]: http(),
  },
})

TIP

In order for the above code snippet to work, you need to have a server running at the provided URL. Below is an example using a Cloudflare Worker (but can work with any server runtime).

See more

ts
import { env } from 'cloudflare:workers'
import { Handler, Kv } from 'tempo.ts/server'

export default {
  fetch(request) {
    return Handler.keyManager({
      kv: Kv.cloudflare(env.KEY_STORE),
      path: '/keys',
    }).fetch(request)
  },
} satisfies ExportedHandler<Env>

Parameters

url

  • Type: string

URL to the key manager server.

options

options.fetch

  • Type: typeof globalThis.fetch
  • Default: globalThis.fetch

Fetch function to use for the key manager server.

Released under the MIT License.