# decodeKeyTuple

> **decodeKeyTuple**(`bytes`): readonly [`KeyTuplePart`](/reference/knotkit/key-encoding/type-aliases/keytuplepart/)\[]

Defined in: [packages/key-encoding/src/tuple.ts:302](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/key-encoding/src/tuple.ts#L302)

Decode an `encodeKeyTuple` key back into its parts. Every decoded part carries an explicit `direction`.

Accepts exactly the bytes `encodeKeyTuple` writes: re-encoding the result reproduces the input byte for byte. An empty array decodes to an empty tuple.

## Parameters

### bytes

`Uint8Array`

## Returns

readonly [`KeyTuplePart`](/reference/knotkit/key-encoding/type-aliases/keytuplepart/)\[]

## Throws

`INVALID_KEY_VALUE` when `bytes` is not a `Uint8Array`.

## Throws

`UNKNOWN_PART_TAG` for a tag that names no kind; `TRUNCATED_KEY` when a payload or terminator is cut off; `INVALID_ESCAPE_SEQUENCE` for a `0x00` not followed by `0xff` or `0x00`; `INVALID_UTF8` for a string payload that is not well-formed UTF-8; `NON_CANONICAL_FLOAT64` for a `NaN` or `-0` bit pattern.
