Skip to content

decodeOpaqueKey

decodeOpaqueKey(encoded, format): Uint8Array

Defined in: src/codecs/opaque/key.ts:86

Decodes key material emitted by encodeOpaqueKey (or ids keygen) back to raw bytes.

string

Hex or base64url string.

OpaqueKeyFormat

Must match how the string was encoded.

Uint8Array

invalid_key_format if format is not "hex" or "base64url".

invalid_key_encoding if the string is malformed for its format.

invalid_key_length if the decoded bytes are not 16, 24, or 32 bytes.