# Class: AuthModule

### Constructors

#### new AuthModule()

> **new AuthModule**(`config`): `AuthModule`

Initializes the `AuthModule` instance.

**Parameters**

**config**

`Config`

An object containing the configuration for the authentication module. The `authApiUrl` field in the config is required to initialize the client.

**Returns**

`AuthModule`

**Defined in**

[module/auth.ts:25](https://github.com/haven1network/haven1-sdk/blob/0001e1c92905c3f34b86b89ff2290ffba9fe7417/packages/api-client/src/module/auth.ts#L25)

### Methods

#### getClient()

> **getClient**(): `undefined` | `Client`<`paths`, \`${string}/${string}\`>

Returns the OpenAPI client instance if it is initialized.

**Returns**

`undefined` | `Client`<`paths`, \`${string}/${string}\`>

The instance or `undefined` if not initialized.

**Defined in**

[module/auth.ts:40](https://github.com/haven1network/haven1-sdk/blob/0001e1c92905c3f34b86b89ff2290ffba9fe7417/packages/api-client/src/module/auth.ts#L40)

***

#### getNonce()

> **getNonce**(): `undefined` | `Promise`<`FetchResponse`<{}, `undefined` | `FetchOptions`<{}>, \`${string}/${string}\`>>

Retrieves a nonce from the authentication API.

The nonce can be used for generating and signing authentication messages.

**Returns**

`undefined` | `Promise`<`FetchResponse`<{}, `undefined` | `FetchOptions`<{}>, \`${string}/${string}\`>>

A `Promise` that resolves with the server's response, or `undefined` if the client is not initialized.

**Defined in**

[module/auth.ts:51](https://github.com/haven1network/haven1-sdk/blob/0001e1c92905c3f34b86b89ff2290ffba9fe7417/packages/api-client/src/module/auth.ts#L51)

***

#### signOut()

> **signOut**(): `undefined` | `Promise`<`FetchResponse`<{}, `undefined` | `FetchOptions`<{}>, \`${string}/${string}\`>>

Signs out the current session using the authentication API.

This function invalidates the authentication session on the backend.

**Returns**

`undefined` | `Promise`<`FetchResponse`<{}, `undefined` | `FetchOptions`<{}>, \`${string}/${string}\`>>

A `Promise` that resolves with the sign-out response, or `undefined` if the client is not initialized.

**Defined in**

[module/auth.ts:96](https://github.com/haven1network/haven1-sdk/blob/0001e1c92905c3f34b86b89ff2290ffba9fe7417/packages/api-client/src/module/auth.ts#L96)

***

#### validateToken()

> **validateToken**(`token`): `undefined` | `Promise`<`FetchResponse`<{}, { `params`: { `path`: { `token`: `string`; }; }; }, \`${string}/${string}\`>>

Validates an authentication token using the authentication API.

**Parameters**

**token**

`string` = `''`

The token to be validated. Defaults to an empty string if not provided.

**Returns**

`undefined` | `Promise`<`FetchResponse`<{}, { `params`: { `path`: { `token`: `string`; }; }; }, \`${string}/${string}\`>>

A `Promise` that resolves with the validation result, or `undefined` if the client is not initialized.

**Defined in**

[module/auth.ts:79](https://github.com/haven1network/haven1-sdk/blob/0001e1c92905c3f34b86b89ff2290ffba9fe7417/packages/api-client/src/module/auth.ts#L79)

***

#### verify()

> **verify**(`message`, `signature`): `undefined` | `Promise`<`FetchResponse`<{}, { `body`: { `message`: `string`; `signature`: `string`; }; }, \`${string}/${string}\`>>

Verifies a given signature against a message using the authentication API.

**Parameters**

**message**

`string`

The original message to be verified.

**signature**

`string`

The signature to verify against the message.

**Returns**

`undefined` | `Promise`<`FetchResponse`<{}, { `body`: { `message`: `string`; `signature`: `string`; }; }, \`${string}/${string}\`>>

A `Promise` that resolves with the verification result, or `undefined` if the client is not initialized.

**Defined in**

[module/auth.ts:63](https://github.com/haven1network/haven1-sdk/blob/0001e1c92905c3f34b86b89ff2290ffba9fe7417/packages/api-client/src/module/auth.ts#L63)


---

# 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.haven1.org/build/developer-tools/haven1-sdk/haven1-sdk-api-client/class-authmodule.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.
