openagent-crypto-wasm · hkdf_sha256
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/crates/openagent-crypto-wasm/src/hkdf_sha256.rs. SHA-256: 150f18f8e76586b7619205c3804ac25284d3c64360f906764ee4bd462fdebc1a.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
hkdf_sha256::PRK_LEN
Length of the HKDF-SHA256 PRK output (== HashLen).
pub const PRK_LEN: usize;Source line: 17.
hkdf_sha256::extract
Performs HKDF-Extract(salt, IKM).
Returns the 32-byte pseudo-random key.
Arguments
salt— optional salt; pass an empty slice for the "no salt" case (the HKDF will internally use 32 zero bytes per RFC 5869).ikm— input keying material.
pub fn extract(salt: &[u8], ikm: &[u8]) -> [u8; PRK_LEN];Source line: 28.
hkdf_sha256::expand
Performs HKDF-Expand(PRK, info, length).
Errors
- [
CryptoError::InvalidLength] ifprkis not exactly 32 bytes. - [
CryptoError::HkdfFailed] iflengthexceeds255 * HashLen(8160 bytes for SHA-256), which is the maximum allowed by RFC 5869.
pub fn expand(prk: &[u8], info: &[u8], length: usize) -> Result<Vec<u8>, CryptoError>;Source line: 43.
hkdf_sha256::derive
Convenience: combined HKDF-Extract + HKDF-Expand in one call.
Equivalent to running [extract] then [expand] but avoids exposing the
intermediate PRK to the caller.
Errors
[CryptoError::HkdfFailed] if length exceeds 255 * HashLen.
pub fn derive(salt: &[u8], ikm: &[u8], info: &[u8], length: usize) -> Result<Vec<u8>, CryptoError>;Source line: 68.