navio-blsct
Version:
TypeScript bindings for the `libblsct` library used by the [Navio](https://nav.io/) blockchain to construct confidential transactions based on the BLS12-381 curve.
28 lines (27 loc) • 844 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Signature = void 0;
const blsct_1 = require("./blsct");
const managedObj_1 = require("./managedObj");
class Signature extends managedObj_1.ManagedObj {
constructor(obj) {
super(obj);
}
static generate(privKey, msg) {
const obj = (0, blsct_1.signMessage)(privKey.value(), msg);
return new Signature(obj);
}
verify(pubKey, msg) {
return (0, blsct_1.verifyMsgSig)(pubKey.value(), msg, this.value());
}
value() {
return (0, blsct_1.castToSignature)(this.obj);
}
serialize() {
return (0, blsct_1.serializeSignature)(this.value());
}
static deserialize(hex) {
return Signature._deserialize(hex, blsct_1.deserializeSignature);
}
}
exports.Signature = Signature;