laksa-core-crypto
Version:
crypto libraries for laksa
27 lines (24 loc) • 771 B
JavaScript
import BN from 'bn.js'
/**
* @class Signature
*
* @description This replaces `elliptic/lib/elliptic/ec/signature`. This is to avoid
* duplicate code in the final bundle, caused by having to bundle elliptic
* twice due to its circular dependencies. This can be removed once
* https://github.com/indutny/elliptic/pull/157 is resolved, or we find the
* time to fork an optimised version of the library.
*/
export class Signature {
constructor(options) {
/**
* @var {BN} r
* @memberof Signature.prototype
*/
this.r = typeof options.r === 'string' ? new BN(options.r, 16) : options.r
/**
* @var {BN} s
* @memberof Signature.prototype
*/
this.s = typeof options.s === 'string' ? new BN(options.s, 16) : options.s
}
}