UNPKG

cognito-srp

Version:

Secure Remote Password protocol implementation compatible with Amazon Cognito.

20 lines (19 loc) 548 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsbn_1 = require("jsbn"); jsbn_1.BigInteger.prototype.toBuffer = function (length) { let str = this.toString(16); if (length) { str = str.padStart(length * 2, '0'); } else if (str.length % 2) { str = '0' + str; } return Buffer.from(str, 'hex'); }; class BigInteger extends jsbn_1.BigInteger { static fromBuffer(buffer) { return new BigInteger(buffer.toString('hex'), 16); } } exports.BigInteger = BigInteger;