class · Browser and Node

# ChallengeBeacon

`@toip-tools/mesh-transport` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/mesh-transport/src/beacon.ts#L10)

Import:

```ts
import { ChallengeBeacon } from "@toip-tools/mesh-transport";
```

## Constructor

Constructor:

```ts
new (opts: {
    identity: Identity;
    mesh: MeshTransport;
    everyMs?: number;
    keep?: number;
}): ChallengeBeacon;
```

### Parameters

**`opts` (required)**

`{ identity: Identity; mesh: MeshTransport; everyMs?: number; keep?: number; }`

**Fields of `opts`**

- **`identity` (required)**: `Identity`
- **`mesh` (required)**: `MeshTransport`
- **`everyMs` (optional)**: `number | undefined`
- **`keep` (optional)**: `number | undefined`

### Returns

`ChallengeBeacon`

## Methods

### `start`

Signature:

```ts
start(): void;
```

No parameters.

#### Returns

`void`

### `stop`

Signature:

```ts
stop(): void;
```

No parameters.

#### Returns

`void`

### `current`

The nonce in the latest beacon.

Signature:

```ts
current(): Uint8Array;
```

No parameters.

#### Returns

`Uint8Array<ArrayBufferLike>`

### `isFresh`

One of the last `keep` nonces (default 2).

Signature:

```ts
isFresh(nonce: Uint8Array): boolean;
```

#### Parameters

- **`nonce` (required)**: `Uint8Array<ArrayBufferLike>`

#### Returns

`boolean`

[Usage guide](https://toip.tools/toolkit/mesh-transport/#usage) · [Error handling](https://toip.tools/toolkit/mesh-transport/#errors) · [All exports](https://toip.tools/toolkit/mesh-transport/api/)

---

This is the Markdown version of https://toip.tools/toolkit/mesh-transport/api/ChallengeBeacon/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
