Skip to content

AesGcm.fromSeed

Derives an AES-256-GCM key from a seed.

The seed must contain at least 32 bytes of cryptographically strong key material. Do not pass a password directly; use a password KDF first.

The permanent derivation contract uses the seed as the HMAC-SHA256 key. The HMAC message uses the ox.aesGcm.fromSeed.v1 domain followed by a 32-bit big-endian counter set to zero.

Imports

Named
import { AesGcm } from 'ox'

Examples

import { AesGcm } from 'ox'
 
const key = await AesGcm.fromSeed(
  '0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'
)

Definition

function fromSeed(
  seed: Hex.Hex | Bytes.Bytes,
): Promise<CryptoKey>

Source: src/core/AesGcm.ts

Parameters

seed

  • Type: Hex.Hex | Bytes.Bytes

Seed containing at least 32 bytes of cryptographically strong key material.

Return Type

A nonextractable AES-256-GCM key for encryption and decryption.

Promise<CryptoKey>