Skip to content

Commit

Permalink
Merge branch 'jeluard-jeluard/remove-node-dependency' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Mar 7, 2024
2 parents 06926ae + 28f8015 commit c4133b3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bls-eth-wasm",
"version": "1.1.0",
"version": "1.1.1",
"description": "BLS signature for Node.js by WebAssembly for Ethereum 2.0",
"main": "src/index.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/bls.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/**
* @param createModule Async factory that returns an emcc initialized Module
* In node, `const createModule = require(`./bls_c.js`)`
* @param getRandomValues Function to get crypto quality random values
*/
const ETH_MODE = true

const _blsSetupFactory = (createModule, getRandomValues) => {
const _blsSetupFactory = (createModule) => {
const exports = {}
/* eslint-disable */
exports.BN254 = 0
Expand Down Expand Up @@ -809,7 +808,7 @@ const _blsSetupFactory = (createModule, getRandomValues) => {
}
exports.init = async (curveType = exports.ethMode ? exports.BLS12_381 : exports.BN254) => {
exports.curveType = curveType
exports.getRandomValues = getRandomValues
exports.getRandomValues = crypto.getRandomValues.bind(crypto)
exports.mod = await createModule({
cryptoGetRandomValues: _cryptoGetRandomValues,
})
Expand Down
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const createModule = require('./bls_c.js')
const blsSetupFactory = require('./bls')
const crypto = require('crypto')

const getRandomValues = crypto.randomFillSync
const bls = blsSetupFactory(createModule, getRandomValues)
const bls = blsSetupFactory(createModule)

module.exports = bls

0 comments on commit c4133b3

Please sign in to comment.