feat: change deriveChildKey to hkdf sha256 and create deriveBlakeChildKey that hashes based on the initial blake3 route used by s5

This commit is contained in:
Derrick Hammer 2023-08-20 02:35:17 -04:00
parent 62b7b0629e
commit 7fefaf0818
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 0 deletions

View File

@ -1,9 +1,18 @@
import { blake3 } from "@noble/hashes/blake3";
import { concatBytes } from "@noble/hashes/utils";
import { hkdf } from "@noble/hashes/hkdf";
import { sha256 } from "@noble/hashes/sha256";
export function deriveChildKey(
parentKey: Uint8Array,
tweak: string,
): Uint8Array {
return hkdf(sha256, parentKey, undefined, tweak, 32);
}
export function deriveBlakeChildKey(
parentKey: Uint8Array,
tweak: string,
): Uint8Array {
const tweakHash = blake3(tweak);