---
title: BearerToken
description: A Bedrock bearer token, the region it was minted for, and when it stops working.
---

A Bedrock bearer token, the region it was minted for, and when it stops working.

A class rather than an object because it carries a secret: `JSON.stringify` gives `{}` and
only `expose()` returns the text.

## Accessors

### expiresAt

#### Get Signature

```ts
get expiresAt(): number;
```

Effective Unix expiry, capped at the known signing credential expiry.
With missing credential expiry metadata this is only an upper bound.

##### Returns

`number`

***

### region

#### Get Signature

```ts
get region(): Region;
```

The region the token was minted for.

##### Returns

[`Region`](/microvms-agentd/reference/typescript/classes/region/)

## Methods

### expose()

```ts
expose(): string;
```

The token text, for a caller writing it into an environment themselves.

#### Returns

`string`

***

### toString()

```ts
toString(): string;
```

The length of the token, never the token.

#### Returns

`string`

## Provenance

This page is generated from `bindings/microvms-js/index.d.ts` by TypeDoc 0.28.20 and typedoc-plugin-markdown 4.13.1, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run dts`. `mise run dts:check` fails when the committed file no longer matches the source.