1 | import { compactAddLength, isU8a, stringToU8a, u8aConcat } from '@polkadot/util';
|
2 | import { blake2AsU8a } from '../blake2/asU8a.js';
|
3 | const HDKD = compactAddLength(stringToU8a('Ed25519HDKD'));
|
4 | export function ed25519DeriveHard(seed, chainCode) {
|
5 | if (!isU8a(chainCode) || chainCode.length !== 32) {
|
6 | throw new Error('Invalid chainCode passed to derive');
|
7 | }
|
8 | return blake2AsU8a(u8aConcat(HDKD, seed, chainCode));
|
9 | }
|