UNPKG

ecash-lib

Version:

Library for eCash transaction building

48 lines 1.53 kB
"use strict"; // Copyright (c) 2025 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. Object.defineProperty(exports, "__esModule", { value: true }); exports.__setPkc = exports.PkcAlgo = void 0; /** Algorithm instance for public key cryptography */ class PkcAlgo { constructor(params) { this.algoOid = params.algoOid; this.params = params.params; } /** * Return a PkcAlgo instance for the given algorithm OID and * elliptic curve params (undefined for RSA). * Throw an exception if the given algo is not supported, otherwise do nothing. */ static fromOid(algoOid, params) { try { PKC.algoSupported(algoOid, params); } catch (ex) { throw new Error(ex); } return new PkcAlgo({ algoOid, params }); } /** * Verify a signature for the given cryptographic algorithm. * Intended to be used in X509 certificate verification. * Throw an exception if the algorithm is not supported. */ verify(sig, msg, pk) { try { PKC.verify(this.algoOid, this.params, sig, msg, pk); } catch (ex) { throw new Error(ex); } } } exports.PkcAlgo = PkcAlgo; const PKC = {}; function __setPkc(pkc) { PKC.verify = pkc.verify; PKC.algoSupported = pkc.algoSupported; } exports.__setPkc = __setPkc; //# sourceMappingURL=publicKeyCrypto.js.map