# Register using SDK

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 [configure your scope](/authentication/configuring-your-scope.md).

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

```typescript
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

<table><thead><tr><th width="247">Parameter</th><th width="218">Description</th><th>Example Value</th></tr></thead><tbody><tr><td>username</td><td>A unique username attached to developers scope. </td><td><code>alice</code></td></tr><tr><td>userDisplayName</td><td>A display name which allows users to chose how they'd like their passkey to be saved. </td><td><code>alice</code></td></tr></tbody></table>

#### registration Response

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

```json
{
    "jsonrpc": "2.0",
    "result": {
        "account_id": "account_id_here",
        "identifier_hash": "identifier_hash_here"
    },
    "id": 1
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0xpass.io/authentication/passkeys/registration/register-using-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
