# Siwe.createMessage

Creates [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) formatted message.

## Imports

:::code-group
```ts [Named]
import { Siwe } from 'ox'
```

```ts [Entrypoint]
import * as Siwe from 'ox/Siwe'
```
:::

## Examples

```ts twoslash
import { Siwe } from 'ox'

Siwe.createMessage({
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
  chainId: 1n,
  domain: 'example.com',
  nonce: 'foobarbaz',
  uri: 'https://example.com/path',
  version: '1'
})
// @log: "example.com wants you to sign in with your Ethereum account:
// @log: 0xA0Cf798816D4b9b9866b5330EEa46a18382f251e
// @log:
// @log:
// @log: URI: https://example.com/path
// @log: Version: 1
// @log: Chain ID: 1
// @log: Nonce: foobarbaz
// @log: Issued At: 2023-02-01T00:00:00.000Z"
```

## Definition

```ts
function createMessage(
  value: Siwe.Message,
): string
```

**Source:** [src/core/Siwe.ts](https://github.com/wevm/ox/blob/main/src/core/Siwe.ts#L513)

## Parameters

### value

* **Type:** [`Siwe.Message`](/api/Siwe/types#siwemessage)

Values to use when creating EIP-4361 formatted message.

#### value.address

* **Type:** `abitype_Address`

The Ethereum address performing the signing.

#### value.chainId

* **Type:** `bigint`

The [EIP-155](https://eips.ethereum.org/EIPS/eip-155) Chain ID to which the session is bound,

#### value.domain

* **Type:** `string`

[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) authority that is requesting the signing.

#### value.expirationTime

* **Type:** `Date`
* **Optional**

Time when the signed authentication message is no longer valid.

#### value.issuedAt

* **Type:** `Date`
* **Optional**

Time when the message was generated, typically the current time.

#### value.nonce

* **Type:** `string`

A random string typically chosen by the relying party and used to prevent replay attacks.

#### value.notBefore

* **Type:** `Date`
* **Optional**

Time when the signed authentication message will become valid.

#### value.requestId

* **Type:** `string`
* **Optional**

A system-specific identifier that may be used to uniquely refer to the sign-in request.

#### value.resources

* **Type:** `string[]`
* **Optional**

A list of information or references to information the user wishes to have resolved as part of authentication by the relying party.

#### value.scheme

* **Type:** `string`
* **Optional**

[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) URI scheme of the origin of the request.

#### value.statement

* **Type:** `string`
* **Optional**

A human-readable ASCII assertion that the user will sign.

#### value.uri

* **Type:** `string`

[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) URI referring to the resource that is the subject of the signing (as in the subject of a claim).

#### value.version

* **Type:** `"1"`

The current version of the SIWE Message.

## Return Type

EIP-4361 formatted message.

`string`
