UNPKG

wallee

Version:
15 lines (14 loc) 691 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EncryptionUtil = void 0; const starkbank_ecdsa_1 = require("starkbank-ecdsa"); class EncryptionUtil { constructor() { } static isContentValid(contentToVerify, contentSignature, encodedPublicKey) { const pubKeyPem = "-----BEGIN PUBLIC KEY-----\n" + encodedPublicKey + "\n-----END PUBLIC KEY-----"; const publicKey = starkbank_ecdsa_1.PublicKey.fromPem(pubKeyPem); const signature = starkbank_ecdsa_1.Signature.fromBase64(contentSignature); return starkbank_ecdsa_1.Ecdsa.verify(contentToVerify, signature, publicKey); } } exports.EncryptionUtil = EncryptionUtil;