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:
parent
62b7b0629e
commit
7fefaf0818
|
@ -1,9 +1,18 @@
|
||||||
import { blake3 } from "@noble/hashes/blake3";
|
import { blake3 } from "@noble/hashes/blake3";
|
||||||
import { concatBytes } from "@noble/hashes/utils";
|
import { concatBytes } from "@noble/hashes/utils";
|
||||||
|
import { hkdf } from "@noble/hashes/hkdf";
|
||||||
|
import { sha256 } from "@noble/hashes/sha256";
|
||||||
|
|
||||||
export function deriveChildKey(
|
export function deriveChildKey(
|
||||||
parentKey: Uint8Array,
|
parentKey: Uint8Array,
|
||||||
tweak: string,
|
tweak: string,
|
||||||
|
): Uint8Array {
|
||||||
|
return hkdf(sha256, parentKey, undefined, tweak, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deriveBlakeChildKey(
|
||||||
|
parentKey: Uint8Array,
|
||||||
|
tweak: string,
|
||||||
): Uint8Array {
|
): Uint8Array {
|
||||||
const tweakHash = blake3(tweak);
|
const tweakHash = blake3(tweak);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue