UNPKG

311 BJavaScriptView Raw
1export function createSeedDeriveFn(fromSeed, derive) {
2 return (keypair, { chainCode, isHard }) => {
3 if (!isHard) {
4 throw new Error('A soft key was found in the path and is not supported');
5 }
6 return fromSeed(derive(keypair.secretKey.subarray(0, 32), chainCode));
7 };
8}