@dfinity/bls-verify
Advanced tools
Comparing version 0.19.2 to 0.19.3-react-native
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.blsVerify = void 0; | ||
const amcl_js_1 = require("amcl-js"); | ||
const utils_1 = require("./utils"); | ||
const blsVerify = async (primaryKey, signature, message) => { | ||
const { verifyShortSignature } = (await Promise.resolve().then(() => require('./verifyShortSignature'))).default(); | ||
const pk = typeof primaryKey === 'string' ? primaryKey : (0, utils_1.toHex)(primaryKey); | ||
const sig = typeof signature === 'string' ? signature : (0, utils_1.toHex)(signature); | ||
const msg = typeof message === 'string' ? message : (0, utils_1.toHex)(message); | ||
const ctx = new amcl_js_1.CTX('BLS12381'); | ||
if (ctx.BLS.init() !== 0) { | ||
throw new Error('Cannot initialize BLS'); | ||
} | ||
return (ctx.BLS.core_verify(ctx.BLS.stringtobytes(sig), ctx.BLS.stringtobytes(msg), ctx.BLS.stringtobytes(pk)) == 0); | ||
return verifyShortSignature(sig, msg, pk); | ||
}; | ||
exports.blsVerify = blsVerify; | ||
//# sourceMappingURL=index.js.map |
@@ -1,13 +0,9 @@ | ||
import { CTX } from 'amcl-js'; | ||
import { toHex } from './utils'; | ||
export const blsVerify = async (primaryKey, signature, message) => { | ||
const { verifyShortSignature } = (await import('./verifyShortSignature')).default(); | ||
const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); | ||
const sig = typeof signature === 'string' ? signature : toHex(signature); | ||
const msg = typeof message === 'string' ? message : toHex(message); | ||
const ctx = new CTX('BLS12381'); | ||
if (ctx.BLS.init() !== 0) { | ||
throw new Error('Cannot initialize BLS'); | ||
} | ||
return (ctx.BLS.core_verify(ctx.BLS.stringtobytes(sig), ctx.BLS.stringtobytes(msg), ctx.BLS.stringtobytes(pk)) == 0); | ||
return verifyShortSignature(sig, msg, pk); | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@dfinity/bls-verify", | ||
"version": "0.19.2", | ||
"version": "0.19.3-react-native", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -16,3 +16,2 @@ "license": "Apache-2.0", | ||
}, | ||
"type": "module", | ||
"keywords": [ | ||
@@ -43,2 +42,3 @@ "internet computer", | ||
"size-limit": "size-limit", | ||
"test": "vitest", | ||
"ci": "npm run prettier && npm run lint && npm run test", | ||
@@ -52,7 +52,8 @@ "lint": "eslint 'src' --ext '.js,.jsx,.ts,.tsx'", | ||
"dependencies": { | ||
"amcl-js": "file:src/vendor/amcl-js" | ||
"@noble/curves": "file:noble-curves-1.2.0.tgz" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "^0.15.16", | ||
"size-limit": "^8.1.0" | ||
"size-limit": "^8.1.0", | ||
"vitest": "^0.34.6" | ||
}, | ||
@@ -59,0 +60,0 @@ "size-limit": [ |
@@ -23,9 +23,2 @@ # @dfinity/bls-verify | ||
import { blsVerify } from '@dfinity/bls-verify'; | ||
import { createActor, canisterId } from '../declarations/example'; | ||
const exampleActor = createActor(canisterId, { | ||
actorOptions: { | ||
blsVerify, | ||
}, | ||
}); | ||
``` |
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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
0
857224
3
24
6040
24
1
No