# deriveChunkNonce

> **deriveChunkNonce**(`baseNonce`, `chunkIndex`, `isLast`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)

Defined in: [packages/filecoin-encryption-envelope/src/nonce.ts:17](https://github.com/FilOzone/synapse-sdk/blob/4fe24ea1c76c9b1fa1489b7cdbb1cc279bd2576a/packages/filecoin-encryption-envelope/src/nonce.ts#L17)

Derive the 12-byte AEAD nonce for one chunk:
`baseNonce (7) ‖ chunkIndex (4, big-endian) ‖ last_flag (1)`.

Returns a freshly allocated array; `baseNonce` is never mutated.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `baseNonce` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
| `chunkIndex` | `number` |
| `isLast` | `boolean` |

## Returns

[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)