1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.privateKeyToBytes = void 0;
|
4 | const utils_1 = require("./utils");
|
5 | function privateKeyToBytes(privateKey) {
|
6 | const privateKeyBuffer = typeof privateKey === 'string' ? (0, utils_1.hexToBytes)(privateKey) : privateKey;
|
7 | if (privateKeyBuffer.length != 32 && privateKeyBuffer.length != 33) {
|
8 | throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${privateKeyBuffer.length}`);
|
9 | }
|
10 | if (privateKeyBuffer.length == 33 && privateKeyBuffer[32] !== 1) {
|
11 | throw new Error('Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01');
|
12 | }
|
13 | return privateKeyBuffer;
|
14 | }
|
15 | exports.privateKeyToBytes = privateKeyToBytes;
|
16 |
|
\ | No newline at end of file |