@harmoniclabs/crypto
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -7,4 +7,7 @@ import { ProjConstructor } from "./noble/abstract/weierstrass.js"; | ||
}>; | ||
export declare function isBlsG1(stuff: any): stuff is BlsG1; | ||
export declare function isBlsG2(stuff: any): stuff is BlsG2; | ||
type UnwrapProjConstructor<Stuff extends ProjConstructor<any>> = Stuff extends ProjConstructor<infer T> ? T : never; | ||
export type Fp2 = UnwrapProjConstructor<typeof BlsG2>; | ||
export declare function isFp2(stuff: any): stuff is Fp2; | ||
type ConstructorReturnType<CtorLike extends { | ||
@@ -38,2 +41,3 @@ new (...args: any): any; | ||
}; | ||
export declare function isBlsResult(stuff: any): stuff is BlsResult; | ||
type Fp6_t = { | ||
@@ -44,2 +48,3 @@ c0: Fp2; | ||
}; | ||
export declare function isFp6(stuff: any): stuff is Fp6_t; | ||
export {}; |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bls12_381_finalVerify = exports.bls12_381_mulMlResult = exports.bls12_381_millerLoop = exports.bls12_381_G2_uncompress = exports.bls12_381_G2_compress = exports.bls12_381_G2_hashToGroup = exports.bls12_381_G2_equal = exports.bls12_381_G2_scalarMul = exports.bls12_381_G2_neg = exports.bls12_381_G2_add = exports.bls12_381_G1_uncompress = exports.bls12_381_G1_compress = exports.bls12_381_G1_hashToGroup = exports.bls12_381_G1_equal = exports.bls12_381_G1_scalarMul = exports.bls12_381_G1_neg = exports.bls12_381_G1_add = exports.BlsG2 = exports.BlsG1 = void 0; | ||
exports.isFp6 = exports.isBlsResult = exports.bls12_381_finalVerify = exports.bls12_381_mulMlResult = exports.bls12_381_millerLoop = exports.bls12_381_G2_uncompress = exports.bls12_381_G2_compress = exports.bls12_381_G2_hashToGroup = exports.bls12_381_G2_equal = exports.bls12_381_G2_scalarMul = exports.bls12_381_G2_neg = exports.bls12_381_G2_add = exports.bls12_381_G1_uncompress = exports.bls12_381_G1_compress = exports.bls12_381_G1_hashToGroup = exports.bls12_381_G1_equal = exports.bls12_381_G1_scalarMul = exports.bls12_381_G1_neg = exports.bls12_381_G1_add = exports.isFp2 = exports.isBlsG2 = exports.isBlsG1 = exports.BlsG2 = exports.BlsG1 = void 0; | ||
var noble_1 = require("./noble/index.js"); | ||
@@ -22,2 +22,20 @@ var hash_to_curve_1 = require("./noble/abstract/hash-to-curve.js"); | ||
exports.BlsG2 = noble_1.bls12_381.G2.ProjectivePoint; | ||
function isBlsG1(stuff) { | ||
return stuff instanceof exports.BlsG1 && (typeof stuff.px === "bigint" && | ||
typeof stuff.py === "bigint" && | ||
typeof stuff.pz === "bigint"); | ||
} | ||
exports.isBlsG1 = isBlsG1; | ||
function isBlsG2(stuff) { | ||
return stuff instanceof exports.BlsG2 && (isFp2(stuff.px) && | ||
isFp2(stuff.py) && | ||
isFp2(stuff.pz)); | ||
} | ||
exports.isBlsG2 = isBlsG2; | ||
function isFp2(stuff) { | ||
return typeof stuff === "object" && (stuff !== null && !Array.isArray(stuff) && | ||
typeof stuff.c0 === "bigint" && | ||
typeof stuff.c1 === "bigint"); | ||
} | ||
exports.isFp2 = isFp2; | ||
var curveOrder = BigInt("52435875175126190479447740508185965837690552500527637822603658699938581184513"); | ||
@@ -239,1 +257,14 @@ var htfDefaults = Object.freeze({ | ||
} | ||
function isBlsResult(stuff) { | ||
return typeof stuff === "object" && (stuff !== null && !Array.isArray(stuff) && | ||
isFp6(stuff.c0) && | ||
isFp6(stuff.c1)); | ||
} | ||
exports.isBlsResult = isBlsResult; | ||
function isFp6(stuff) { | ||
return typeof stuff === "object" && (stuff !== null && !Array.isArray(stuff) && | ||
isFp2(stuff.c0) && | ||
isFp2(stuff.c1) && | ||
isFp2(stuff.c2)); | ||
} | ||
exports.isFp6 = isFp6; |
{ | ||
"name": "@harmoniclabs/crypto", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "collection of cryptographic functions that support every js runtime for ES5+", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
359867
8298
0