UNPKG

@okxweb3/coin-bitcoin

Version:

@okxweb3/coin-bitcoin is a Bitcoin SDK for building Web3 wallets and applications. It supports BTC, BSV, DOGE, LTC, and TBTC, enabling private key management, transaction signing, address generation, and inscriptions like BRC-20, Runes, CAT, and Atomicals

19 lines 665 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeChecker = void 0; function makeChecker(pubkeyTypes) { return checkPubkey; function checkPubkey(keyVal) { let pubkey; if (pubkeyTypes.includes(keyVal.key[0])) { pubkey = keyVal.key.slice(1); if (!(pubkey.length === 33 || pubkey.length === 65) || ![2, 3, 4].includes(pubkey[0])) { throw new Error('Format Error: invalid pubkey in key 0x' + keyVal.key.toString('hex')); } } return pubkey; } } exports.makeChecker = makeChecker; //# sourceMappingURL=checkPubkey.js.map