libweb/src/keys.ts

12 lines
279 B
TypeScript
Raw Normal View History

2023-06-21 08:32:21 +00:00
import { blake3 } from "@noble/hashes/blake3";
import { concatBytes } from "@noble/hashes/utils";
export function deriveChildKey(
parentKey: Uint8Array,
tweak: string,
): Uint8Array {
const tweakHash = blake3(tweak);
return blake3(concatBytes(parentKey, tweakHash));
}