Adding a Credential to an Existing Wallet
1. Initialize the Passkey Client
import { Turnkey, TurnkeySDKBrowserConfig } from "@turnkey/sdk-browser";
import turnkeyConfig from "./turnkey.json"
const turnkey = new Turnkey(turnkeyConfig);
const passkeyClient = turnkey.passkeyClient();
2. Create a Local Passkey Credential
This will prompt a user natively in their browser to create a passkey.
const credential = await passkeyClient.createUserPasskey({
  publicKey: {
    user: {
      name: <userName>,
      displayName: <userDisplayName>
    }
  }
})
3. Call createAuthenticators to add the credential
const authenticatorsResponse = await passkeyClient.createAuthenticators({
  authenticators: [{
    authenticatorName: <passkeyName>,
    challenge: credential.encodedChallenge,
    attestation: credential.attestation
  }],
  userId: <userId>
})