Getting StartedAdvanced Options

IdentityKitProvider also allows to set some important advanced props listed below:

authType

IdentityKitAuthType | {[signerId:string]: IdentityKitAuthType}

// By default authType is set to
{
  [NFIDW.id]: IdentityKitAuthType.DELEGATION,
  [Plug.id]: IdentityKitAuthType.DELEGATION,
  [OISY.id]: IdentityKitAuthType.ACCOUNTS, // does not support icrc34_delegation
  [InternetIdentity.id]: IdentityKitAuthType.DELEGATION, // does not support icrc27_accounts
  [Stoic.id]: IdentityKitAuthType.DELEGATION // does not support icrc27_accounts
}
 
import { IdentityKitProvider } from "@nfid/identitykit/react"
 
// authType can be set for all signers at once (the list above takes priority over this)
export const YourApp = () => {
  return (
    <IdentityKitProvider authType={IdentityKitAuthType.DELEGATION}>
      <ConnectWallet />
    </IdentityKitProvider>
  )
}
 
// or custom for specific signer
export const YourApp = () => {
  return (
    <IdentityKitProvider authType={{
      [signerId_1]: IdentityKitAuthType.DELEGATION,
      [signerId_2]: IdentityKitAuthType.ACCOUNTS
    }}>
      <ConnectWallet />
    </IdentityKitProvider>
  )
}
ℹ️

Note: authType will not be automatically switched if it doesnt support authType that was manually set

signerClientOptions

import { IdentityKitProvider } from "@nfid/identitykit/react"
 
export const YourApp = () => {
  return (
    <IdentityKitProvider signerClientOptions={{}}>
      <ConnectWallet />
    </IdentityKitProvider>
  )
}

maxTimeToLive

bigint

Defines the delegation’s expiration duration in nanoseconds. This parameter is optional and defaults to 30 minutes (1_800_000_000_000 nanoseconds). It can be set to any valid BigInt value, depending on system requirements.

  • Minimum recommended: 5 minutes (300_000_000_000 nanoseconds)
  • Maximum recommended: 6 months (15_552_000_000_000_000 nanoseconds)

storage

AuthClientStorage | undefined

Optional storage with methods set, get and remove, IndexedDB by default.

keyType

"ECDSA" | "Ed25519" | undefined

If you are using a custom storage provider that does not support CryptoKey storage, you should use Ed25519 as the key type, as it can serialize to a string. Ed25519 will be used by default.

identity

identity: SignIdentity | PartialIdentity | undefined

Optional identity to use as base.

idleOptions

Customize idle

import { IdentityKitProvider } from "@nfid/identitykit/react"
 
export const YourApp = () => {
  return (
    <IdentityKitProvider
      signerClientOptions={{
        idleOptions: {},
      }}
    >
      <ConnectWallet />
    </IdentityKitProvider>
  )
}

idleTimeout

number

Timeout to logout user due to inactivity in milliseconds, optional, 14_400_000 (4 hours) by default, maximum value is 2_147_483_647 (~24 days, max 32 bit integer), will be used in case of bigger provided value.

disableIdle

boolean

Disable logout on idle timeout, enabled by default.

crypto

Pick<Crypto, "getRandomValues" | "randomUUID"> | undefined

Optional, used to generate random bytes, browser/node Crypto by default.

window

Window | undefined

Optional relying party window, used to listen for incoming message events, globalThis.window by default.

windowOpenerFeatures

string | undefined

Optional string containing a comma-separated list of window features in the form name=value for signers that open in the window. For example: left=100,top=100,width=320,height=320.

allowInternetIdentityPinAuthentication

boolean | undefined

If present, indicates whether or not the Identity Provider should allow the user to authenticate and/or register using a temporary key/PIN identity.