> ## Documentation Index
> Fetch the complete documentation index at: https://baileys.wiki/llms.txt
> Use this file to discover all available pages before exploring further.

# MessageKey

> Protobuf class MessageKey generated from WAProto.

Defined in: [WAProto/index.d.ts:10965](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10965)

## Implements

* [`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey)

## Constructors

### new MessageKey()

> **new MessageKey**(`p`?): [`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

Defined in: [WAProto/index.d.ts:10966](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10966)

#### Parameters

##### p?

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey)

#### Returns

[`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

## Properties

### cipherKey?

> `optional` **cipherKey**: `null` | `Uint8Array`\<`ArrayBufferLike`>

Defined in: [WAProto/index.d.ts:10968](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10968)

#### Implementation of

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey).[`cipherKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey#cipherkey)

***

### index?

> `optional` **index**: `null` | `number`

Defined in: [WAProto/index.d.ts:10967](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10967)

#### Implementation of

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey).[`index`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey#index)

***

### iv?

> `optional` **iv**: `null` | `Uint8Array`\<`ArrayBufferLike`>

Defined in: [WAProto/index.d.ts:10970](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10970)

#### Implementation of

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey).[`iv`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey#iv)

***

### macKey?

> `optional` **macKey**: `null` | `Uint8Array`\<`ArrayBufferLike`>

Defined in: [WAProto/index.d.ts:10969](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10969)

#### Implementation of

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey).[`macKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey#mackey)

## Methods

### create()

> `static` **create**(`properties`?): [`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

Defined in: [WAProto/index.d.ts:10971](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10971)

#### Parameters

##### properties?

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey)

#### Returns

[`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

***

### decode()

> `static` **decode**(`r`, `l`?): [`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

Defined in: [WAProto/index.d.ts:10973](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10973)

#### Parameters

##### r

`Uint8Array`\<`ArrayBufferLike`> | `Reader`

##### l?

`number`

#### Returns

[`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

***

### encode()

> `static` **encode**(`m`, `w`?): `Writer`

Defined in: [WAProto/index.d.ts:10972](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10972)

#### Parameters

##### m

[`IMessageKey`](/proto-reference/SessionStructure/Chain/interfaces/IMessageKey)

##### w?

`Writer`

#### Returns

`Writer`

***

### fromObject()

> `static` **fromObject**(`d`): [`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

Defined in: [WAProto/index.d.ts:10974](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10974)

#### Parameters

##### d

#### Returns

[`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

***

### getTypeUrl()

> `static` **getTypeUrl**(`typeUrlPrefix`?): `string`

Defined in: [WAProto/index.d.ts:10977](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10977)

#### Parameters

##### typeUrlPrefix?

`string`

#### Returns

`string`

***

### toJSON()

> **toJSON**(): `object`

Defined in: [WAProto/index.d.ts:10976](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10976)

#### Returns

`object`

***

### toObject()

> `static` **toObject**(`m`, `o`?): `object`

Defined in: [WAProto/index.d.ts:10975](https://github.com/WhiskeySockets/Baileys/blob/master/WAProto/index.d.ts#L10975)

#### Parameters

##### m

[`MessageKey`](/proto-reference/SessionStructure/Chain/classes/MessageKey)

##### o?

`IConversionOptions`

#### Returns

`object`
