@tidecloak/js
Version:
TideCloak client side JS SDK
24 lines • 846 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreSign = PreSign;
exports.Sign = Sign;
const Ed25519_js_1 = require("../Cryptide/Ed25519.js");
const Math_js_1 = require("../Cryptide/Math.js");
/**
* @param {Point[][]} GRij
*/
function PreSign(GRij) {
if (!GRij.every(Gri => Gri.length == GRij[0].length))
throw new Error("Orks returned different amount of Grs");
return GRij[0].map((_, i) => GRij.reduce((sum, next) => sum.add(next[i]), Ed25519_js_1.Point.ZERO));
}
/**
*
* @param {BigInt[][]} Sis
*/
function Sign(Sis) {
if (!Sis.every(Si => Si.length == Sis[0].length))
throw new Error("Orks returned different amount of Si");
return Sis[0].map((_, i) => (0, Math_js_1.mod)(Sis.reduce((sum, next) => sum + next[i], BigInt(0))));
}
//# sourceMappingURL=KeySigning.js.map