# Function: claimUsername()

```ts
function claimUsername(
   text, 
   contactKey, 
   code, 
   fetcher?
): Promise<number>;
```

Defined in: [packages/core/src/inbox/names.ts:200](https://github.com/leifriksheim/minca/blob/main/core/src/inbox/names.ts#L200)

Claims a username on its domain's name service, pointing it at an inbox
code, or gives it up with `code` null. Claiming again renews it. Only the
name key that holds a name can change it; it is derived here, from the
name as parsed, so every device and every spelling signs with the same one.

## Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `text` | `string` | `undefined` | - |
| `contactKey` | `Uint8Array` | `undefined` | The contact key's private scalar |
| `code` | `string` \| `null` | `undefined` | - |
| `fetcher?` | (`input`, `init?`) => `Promise`\<`Response`\> | `globalThis.fetch` | - |

## Returns

`Promise`\<`number`\>

When the name lapses unless claimed again, ms

## Throws

When the text isn't a username, the code isn't this account's, the domain names no name service, or the service refuses
