1 | // Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
2 | // SPDX-License-Identifier: Apache-2.0
|
3 |
|
4 | import { compactAddLength, isU8a, stringToU8a, u8aConcat } from '@polkadot/util';
|
5 | import { blake2AsU8a } from "../blake2/asU8a.js";
|
6 | const HDKD = compactAddLength(stringToU8a('Ed25519HDKD'));
|
7 | export function ed25519DeriveHard(seed, chainCode) {
|
8 | if (!isU8a(chainCode) || chainCode.length !== 32) {
|
9 | throw new Error('Invalid chainCode passed to derive');
|
10 | }
|
11 | return blake2AsU8a(u8aConcat(HDKD, seed, chainCode));
|
12 | } |
\ | No newline at end of file |