UNPKG

apostille-library

Version:

A novel & holistic blockchain notarization and timestamping with transferable, updatable, branded, and conjointly owned notarizations.

23 lines 922 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const js_sha3_1 = require("js-sha3"); const nem2_sdk_1 = require("nem2-sdk"); const Errors_1 = require("./../types/Errors"); const HashFunction_1 = require("./HashFunction"); class SHA3_256 extends HashFunction_1.HashFunction { constructor() { super('90'); } signedHashing(data, signerPrivateKey, networkType) { const dataHash = js_sha3_1.sha3_256(data); if (networkType === nem2_sdk_1.NetworkType.MAIN_NET || networkType === nem2_sdk_1.NetworkType.TEST_NET) { throw Errors_1.Errors[Errors_1.Errors.NETWORK_TYPE_NOT_SUPPORTED]; } else { const signer = nem2_sdk_1.Account.createFromPrivateKey(signerPrivateKey, networkType); return this.checksum + signer.signData(dataHash); } } } exports.SHA3_256 = SHA3_256; //# sourceMappingURL=sha3-256.js.map