@mattrglobal/bls12381-key-pair
Advanced tools
Comparing version 1.1.1-unstable.4ae10eb to 1.1.1-unstable.72c9cb3
@@ -1,6 +0,6 @@ | ||
## 1.1.1-unstable.4ae10eb (2023-09-27) | ||
## 1.1.1-unstable.72c9cb3 (2023-09-28) | ||
## 1.1.1 (2023-09-27) | ||
## 1.1.1 (2023-09-28) | ||
@@ -7,0 +7,0 @@ |
@@ -27,2 +27,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Bls12381G1KeyPair = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -139,7 +140,7 @@ const rfc4648_1 = require("rfc4648"); | ||
static generate(options) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// TODO: Do we want to set a minimum size input for the seed? | ||
const keyPair = ((_a = options) === null || _a === void 0 ? void 0 : _a.seed) ? yield bbs_signatures_1.generateBls12381G1KeyPair(options.seed) | ||
: yield bbs_signatures_1.generateBls12381G1KeyPair(); | ||
const keyPair = (options === null || options === void 0 ? void 0 : options.seed) | ||
? yield (0, bbs_signatures_1.generateBls12381G1KeyPair)(options.seed) | ||
: yield (0, bbs_signatures_1.generateBls12381G1KeyPair)(); | ||
return new Bls12381G1KeyPair(Object.assign(Object.assign({}, options), { privateKeyBase58: bs58_1.default.encode(keyPair.secretKey), publicKeyBase58: bs58_1.default.encode(keyPair.publicKey) })); | ||
@@ -174,15 +175,15 @@ }); | ||
**/ | ||
validators_1.assertBls12381G1PrivateJwk(privateKeyJwk)) { | ||
(0, validators_1.assertBls12381G1PrivateJwk)(privateKeyJwk)) { | ||
return new Bls12381G1KeyPair({ | ||
id, | ||
controller, | ||
publicKeyBase58: utils_1.convertBase64urlToBase58(privateKeyJwk.x), | ||
privateKeyBase58: utils_1.convertBase64urlToBase58(privateKeyJwk.d) | ||
publicKeyBase58: (0, utils_1.convertBase64urlToBase58)(privateKeyJwk.x), | ||
privateKeyBase58: (0, utils_1.convertBase64urlToBase58)(privateKeyJwk.d) | ||
}); | ||
} | ||
if (validators_1.assertBls12381G1PublicJwk(publicKeyJwk)) { | ||
if ((0, validators_1.assertBls12381G1PublicJwk)(publicKeyJwk)) { | ||
return new Bls12381G1KeyPair({ | ||
id, | ||
controller, | ||
publicKeyBase58: utils_1.convertBase64urlToBase58(publicKeyJwk.x) | ||
publicKeyBase58: (0, utils_1.convertBase64urlToBase58)(publicKeyJwk.x) | ||
}); | ||
@@ -189,0 +190,0 @@ } |
@@ -27,2 +27,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Bls12381G2KeyPair = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -77,3 +78,3 @@ const rfc4648_1 = require("rfc4648"); | ||
if (data instanceof Uint8Array) { | ||
return yield bbs_signatures_1.blsSign({ | ||
return yield (0, bbs_signatures_1.blsSign)({ | ||
messages: [data], | ||
@@ -86,3 +87,3 @@ keyPair: { | ||
} | ||
return yield bbs_signatures_1.blsSign({ | ||
return yield (0, bbs_signatures_1.blsSign)({ | ||
messages: data, | ||
@@ -123,3 +124,3 @@ keyPair: { | ||
if (data instanceof Uint8Array) { | ||
return (yield bbs_signatures_1.blsVerify({ | ||
return (yield (0, bbs_signatures_1.blsVerify)({ | ||
messages: [data], | ||
@@ -130,3 +131,3 @@ publicKey: new Uint8Array(key.publicKeyBuffer), | ||
} | ||
return (yield bbs_signatures_1.blsVerify({ | ||
return (yield (0, bbs_signatures_1.blsVerify)({ | ||
messages: data, | ||
@@ -188,6 +189,6 @@ publicKey: new Uint8Array(key.publicKeyBuffer), | ||
static generate(options) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const keyPair = ((_a = options) === null || _a === void 0 ? void 0 : _a.seed) ? yield bbs_signatures_1.generateBls12381G2KeyPair(options.seed) | ||
: yield bbs_signatures_1.generateBls12381G2KeyPair(); | ||
const keyPair = (options === null || options === void 0 ? void 0 : options.seed) | ||
? yield (0, bbs_signatures_1.generateBls12381G2KeyPair)(options.seed) | ||
: yield (0, bbs_signatures_1.generateBls12381G2KeyPair)(); | ||
return new Bls12381G2KeyPair(Object.assign(Object.assign({}, options), { privateKeyBase58: bs58_1.default.encode(keyPair.secretKey), publicKeyBase58: bs58_1.default.encode(keyPair.publicKey) })); | ||
@@ -222,15 +223,15 @@ }); | ||
**/ | ||
validators_1.assertBls12381G2PrivateJwk(privateKeyJwk)) { | ||
(0, validators_1.assertBls12381G2PrivateJwk)(privateKeyJwk)) { | ||
return new Bls12381G2KeyPair({ | ||
id, | ||
controller, | ||
publicKeyBase58: utils_1.convertBase64urlToBase58(privateKeyJwk.x), | ||
privateKeyBase58: utils_1.convertBase64urlToBase58(privateKeyJwk.d) | ||
publicKeyBase58: (0, utils_1.convertBase64urlToBase58)(privateKeyJwk.x), | ||
privateKeyBase58: (0, utils_1.convertBase64urlToBase58)(privateKeyJwk.d) | ||
}); | ||
} | ||
if (validators_1.assertBls12381G2PublicJwk(publicKeyJwk)) { | ||
if ((0, validators_1.assertBls12381G2PublicJwk)(publicKeyJwk)) { | ||
return new Bls12381G2KeyPair({ | ||
id, | ||
controller, | ||
publicKeyBase58: utils_1.convertBase64urlToBase58(publicKeyJwk.x) | ||
publicKeyBase58: (0, utils_1.convertBase64urlToBase58)(publicKeyJwk.x) | ||
}); | ||
@@ -237,0 +238,0 @@ } |
@@ -15,6 +15,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Bls12381G2KeyPair = exports.Bls12381G1KeyPair = void 0; | ||
var Bls12381G1KeyPair_1 = require("./Bls12381G1KeyPair"); | ||
exports.Bls12381G1KeyPair = Bls12381G1KeyPair_1.Bls12381G1KeyPair; | ||
Object.defineProperty(exports, "Bls12381G1KeyPair", { enumerable: true, get: function () { return Bls12381G1KeyPair_1.Bls12381G1KeyPair; } }); | ||
var Bls12381G2KeyPair_1 = require("./Bls12381G2KeyPair"); | ||
exports.Bls12381G2KeyPair = Bls12381G2KeyPair_1.Bls12381G2KeyPair; | ||
Object.defineProperty(exports, "Bls12381G2KeyPair", { enumerable: true, get: function () { return Bls12381G2KeyPair_1.Bls12381G2KeyPair; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BlsCurveName = void 0; | ||
var BlsCurveName; | ||
@@ -17,0 +18,0 @@ (function (BlsCurveName) { |
@@ -15,6 +15,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.JwkKty = exports.BlsCurveName = void 0; | ||
var BlsCurveName_1 = require("./BlsCurveName"); | ||
exports.BlsCurveName = BlsCurveName_1.BlsCurveName; | ||
Object.defineProperty(exports, "BlsCurveName", { enumerable: true, get: function () { return BlsCurveName_1.BlsCurveName; } }); | ||
var JwkKty_1 = require("./JwkKty"); | ||
exports.JwkKty = JwkKty_1.JwkKty; | ||
Object.defineProperty(exports, "JwkKty", { enumerable: true, get: function () { return JwkKty_1.JwkKty; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.JwkKty = void 0; | ||
var JwkKty; | ||
@@ -17,0 +18,0 @@ (function (JwkKty) { |
@@ -18,7 +18,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertBase64urlToBase58 = void 0; | ||
const rfc4648_1 = require("rfc4648"); | ||
const bs58_1 = __importDefault(require("bs58")); | ||
exports.convertBase64urlToBase58 = (value) => { | ||
const convertBase64urlToBase58 = (value) => { | ||
return bs58_1.default.encode(rfc4648_1.base64url.parse(value, { loose: true })); | ||
}; | ||
exports.convertBase64urlToBase58 = convertBase64urlToBase58; | ||
//# sourceMappingURL=codec.js.map |
@@ -15,4 +15,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertBase64urlToBase58 = void 0; | ||
var codec_1 = require("./codec"); | ||
exports.convertBase64urlToBase58 = codec_1.convertBase64urlToBase58; | ||
Object.defineProperty(exports, "convertBase64urlToBase58", { enumerable: true, get: function () { return codec_1.convertBase64urlToBase58; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -15,16 +15,19 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assertBls12381G1PrivateJwk = exports.assertBls12381G1PublicJwk = void 0; | ||
const JsonWebKey_1 = require("./JsonWebKey"); | ||
const types_1 = require("../types"); | ||
exports.assertBls12381G1PublicJwk = (jwk) => { | ||
const assertBls12381G1PublicJwk = (jwk) => { | ||
// Returns false because the BLS12-381 G1 x coordinate is not the proper length | ||
return (JsonWebKey_1.assertPublicBlsJwk(jwk) && | ||
return ((0, JsonWebKey_1.assertPublicBlsJwk)(jwk) && | ||
(jwk.crv === types_1.BlsCurveName.DEPRECATED_G1 || jwk.crv === types_1.BlsCurveName.G1) && | ||
jwk.x.length === 64); | ||
}; | ||
exports.assertBls12381G1PrivateJwk = (jwk) => { | ||
exports.assertBls12381G1PublicJwk = assertBls12381G1PublicJwk; | ||
const assertBls12381G1PrivateJwk = (jwk) => { | ||
// Returns false because the BLS12-381 G1 x coordinate is not the proper length | ||
return (JsonWebKey_1.assertPrivateBlsJwk(jwk) && | ||
return ((0, JsonWebKey_1.assertPrivateBlsJwk)(jwk) && | ||
(jwk.crv === types_1.BlsCurveName.DEPRECATED_G1 || jwk.crv === types_1.BlsCurveName.G1) && | ||
jwk.x.length === 64); | ||
}; | ||
exports.assertBls12381G1PrivateJwk = assertBls12381G1PrivateJwk; | ||
//# sourceMappingURL=Bls12381G1Jwk.js.map |
@@ -15,16 +15,19 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assertBls12381G2PrivateJwk = exports.assertBls12381G2PublicJwk = void 0; | ||
const JsonWebKey_1 = require("./JsonWebKey"); | ||
const types_1 = require("../types"); | ||
exports.assertBls12381G2PublicJwk = (jwk) => { | ||
const assertBls12381G2PublicJwk = (jwk) => { | ||
// Returns false because the BLS12-381 G2 x coordinate is not the proper length | ||
return (JsonWebKey_1.assertPublicBlsJwk(jwk) && | ||
return ((0, JsonWebKey_1.assertPublicBlsJwk)(jwk) && | ||
(jwk.crv === types_1.BlsCurveName.DEPRECATED_G2 || jwk.crv === types_1.BlsCurveName.G2) && | ||
jwk.x.length === 128); | ||
}; | ||
exports.assertBls12381G2PrivateJwk = (jwk) => { | ||
exports.assertBls12381G2PublicJwk = assertBls12381G2PublicJwk; | ||
const assertBls12381G2PrivateJwk = (jwk) => { | ||
// Returns false because the BLS12-381 G2 x coordinate is not the proper length | ||
return (JsonWebKey_1.assertPrivateBlsJwk(jwk) && | ||
return ((0, JsonWebKey_1.assertPrivateBlsJwk)(jwk) && | ||
(jwk.crv === types_1.BlsCurveName.DEPRECATED_G2 || jwk.crv === types_1.BlsCurveName.G2) && | ||
jwk.x.length === 128); | ||
}; | ||
exports.assertBls12381G2PrivateJwk = assertBls12381G2PrivateJwk; | ||
//# sourceMappingURL=Bls12381G2Jwk.js.map |
@@ -15,8 +15,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assertBls12381G2PublicJwk = exports.assertBls12381G2PrivateJwk = exports.assertBls12381G1PublicJwk = exports.assertBls12381G1PrivateJwk = void 0; | ||
var Bls12381G1Jwk_1 = require("./Bls12381G1Jwk"); | ||
exports.assertBls12381G1PrivateJwk = Bls12381G1Jwk_1.assertBls12381G1PrivateJwk; | ||
exports.assertBls12381G1PublicJwk = Bls12381G1Jwk_1.assertBls12381G1PublicJwk; | ||
Object.defineProperty(exports, "assertBls12381G1PrivateJwk", { enumerable: true, get: function () { return Bls12381G1Jwk_1.assertBls12381G1PrivateJwk; } }); | ||
Object.defineProperty(exports, "assertBls12381G1PublicJwk", { enumerable: true, get: function () { return Bls12381G1Jwk_1.assertBls12381G1PublicJwk; } }); | ||
var Bls12381G2Jwk_1 = require("./Bls12381G2Jwk"); | ||
exports.assertBls12381G2PrivateJwk = Bls12381G2Jwk_1.assertBls12381G2PrivateJwk; | ||
exports.assertBls12381G2PublicJwk = Bls12381G2Jwk_1.assertBls12381G2PublicJwk; | ||
Object.defineProperty(exports, "assertBls12381G2PrivateJwk", { enumerable: true, get: function () { return Bls12381G2Jwk_1.assertBls12381G2PrivateJwk; } }); | ||
Object.defineProperty(exports, "assertBls12381G2PublicJwk", { enumerable: true, get: function () { return Bls12381G2Jwk_1.assertBls12381G2PublicJwk; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assertPrivateBlsJwk = exports.assertPublicBlsJwk = void 0; | ||
const types_1 = require("../types"); | ||
@@ -31,3 +32,3 @@ const checkCommonBlsJwkValues = (jwk) => { | ||
}; | ||
exports.assertPublicBlsJwk = (jwk) => { | ||
const assertPublicBlsJwk = (jwk) => { | ||
// Performs common checks, but also checks to make sure a d value is not included | ||
@@ -37,5 +38,7 @@ // If a d value is included then this is a private key not a public key | ||
}; | ||
exports.assertPrivateBlsJwk = (jwk) => { | ||
exports.assertPublicBlsJwk = assertPublicBlsJwk; | ||
const assertPrivateBlsJwk = (jwk) => { | ||
return checkCommonBlsJwkValues(jwk); | ||
}; | ||
exports.assertPrivateBlsJwk = assertPrivateBlsJwk; | ||
//# sourceMappingURL=JsonWebKey.js.map |
{ | ||
"name": "@mattrglobal/bls12381-key-pair", | ||
"version": "1.1.1-unstable.4ae10eb", | ||
"version": "1.1.1-unstable.72c9cb3", | ||
"description": "A library for using BLS 12-381 key pairs with BBS+ signatures", | ||
@@ -32,3 +32,3 @@ "homepage": "https://github.com/mattrglobal/bls12381-key-pair", | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=16.0.0" | ||
}, | ||
@@ -51,12 +51,12 @@ "scripts": { | ||
"devDependencies": { | ||
"@commitlint/cli": "8.3.5", | ||
"@commitlint/config-conventional": "8.3.4", | ||
"@commitlint/cli": "17.7.1", | ||
"@commitlint/config-conventional": "17.7.0", | ||
"@types/bs58": "4.0.1", | ||
"@types/jest": "25.2.1", | ||
"@types/node": "12.7.2", | ||
"@types/node": "18.18.0", | ||
"@typescript-eslint/eslint-plugin": "2.28.0", | ||
"@typescript-eslint/parser": "2.28.0", | ||
"conventional-changelog": "3.1.18", | ||
"conventional-changelog-cli": "2.0.31", | ||
"cz-conventional-changelog": "3.1.0", | ||
"conventional-changelog": "5.1.0", | ||
"conventional-changelog-cli": "4.1.0", | ||
"cz-conventional-changelog": "3.3.0", | ||
"eslint": "6.8.0", | ||
@@ -66,9 +66,9 @@ "eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"husky": "4.2.5", | ||
"jest": "25.4.0", | ||
"husky": "4.3.8", | ||
"jest": "29.6.4", | ||
"prettier": "1.19.1", | ||
"pretty-quick": "2.0.1", | ||
"ts-jest": "25.4.0", | ||
"ts-jest": "29.1.1", | ||
"ts-node": "8.4.1", | ||
"typescript": "3.7.5" | ||
"typescript": "4.9.5" | ||
}, | ||
@@ -75,0 +75,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
101256
1560