Passport
  • 👩‍💻Welcome
  • How Passport Works
    • Overview
    • Background
      • Threshold Cryptography
      • Secure Multi-Party Computation
      • Distributed Architecture
      • Secure Enclaves
    • In Depth
      • Under the Hood
      • User Flows and Account Controls
      • The Halides Model
      • End-to-End Encryption
      • Security
      • Node Operation
  • guides and examples
    • Getting Started
    • Quickstarts and Examples
      • Passkey Account
      • Clerk Auth
      • Lambda Quickstart
  • Authentication
    • Overview
    • Configuring your scope
    • Passkeys
      • Registration
        • Register using SDK
        • Register using API
          • Initiate Registration
          • Complete Registration
      • Authentication
        • Authenticating with SDK
        • Authenticating with API
          • Initiate Authentication
          • Complete Authentication
    • Developer Owned Auth
      • Registration
        • Register using SDK
        • Register using API
          • Delegate Registration
  • Wallet Operations
    • Overview
    • Passkeys Signer
      • Sign Message
        • Sign Message SDK
        • Sign Message API
      • Sign Transaction
        • Sign Transaction SDK
        • Sign Transaction API
    • DOA Signer
      • Sign Message
        • Sign Message SDK
        • Sign Message API
      • Sign Transaction
        • Sign Transaction SDK
        • Sign Transaction API
    • Viem Support
  • Programmability
    • Overview
    • Passport Lambda
    • Lambda Functions
      • Create Lambda
        • Create Lambda SDK
        • Create Lambda API
      • Execute Lambda
        • Execute Lambda SDK
        • Execute Lambda API
      • List Lambda
        • List Lambda SDK
        • List Lambda API
  • Appendix
    • Moving to Mainnet
    • State Of The Network
    • Generating DOA Keys
    • API Request Setup
      • Unauthenticated Requests
      • Authenticated Requests
Powered by GitBook
On this page
  1. Authentication
  2. Passkeys
  3. Registration

Register using SDK

PreviousRegistrationNextRegister using API

Last updated 1 year ago

The register method is your entry to Passport Protocol. The register method generates a key, using a passkey with a unique username under your scope, you can read more about scopes and how to .

To use the register method you'll have to instantiate an instance of Passport from the SDK and simply call the register function with the relevant parameters

import { Passport } from "@0xpass/passport";
import { WebauthnSigner } from "@0xpass/webauthn-signer";

const signer = new WebauthnSigner({
      rpId: window.location.hostname,
      rpName: "rpName",
});

const passport = new Passport({
    scope_id: "insert_your_scope_id",
    signer: signer,
});

const userInput {
   username: "insert_username_here"
   userDisplayName: "insert_user_display_name_here"
}

await passport.setupEncryption(); 
await passport.register(userInput);

Here we set up a Passport instance and a WebauthnSigner we use to generate passkeys and signatures. We also set up a userInput, which contains a unique username attached to your scope, and a userDisplayName which allows users to chose how they'd like their passkey to be saved. The setupEncryption method is called to create a secure channel of communication with the protocol.

registration parameters

Parameter
Description
Example Value

username

A unique username attached to developers scope.

alice

userDisplayName

A display name which allows users to chose how they'd like their passkey to be saved.

alice

registration Response

A successful response will return the following, an account_id and corresponding identifier_hash

{
    "jsonrpc": "2.0",
    "result": {
        "account_id": "account_id_here",
        "identifier_hash": "identifier_hash_here"
    },
    "id": 1
}
configure your scope