diff --git a/bls-demo.js b/bls-demo.js index 289f147..fa5db3f 100644 --- a/bls-demo.js +++ b/bls-demo.js @@ -1,9 +1,3 @@ -// Get random source -const crypto = window.crypto || window.msCrypto -const getRandomValues = x => crypto.getRandomValues(x) -// Setup BLS -const bls = blsSetupFactory(createBlsModule, getRandomValues) - function getValue (name) { return document.getElementsByName(name)[0].value } function setValue (name, val) { document.getElementsByName(name)[0].value = val } function getText (name) { return document.getElementsByName(name)[0].innerText } diff --git a/bls.js b/bls.js index 9e89968..9ed6747 100644 --- a/bls.js +++ b/bls.js @@ -665,4 +665,7 @@ if (typeof exports === 'object' && typeof module === 'object') { // Browser export if (typeof window === 'object') { window.blsSetupFactory = blsSetupFactory + const crypto = window.crypto || window.msCrypto + const getRandomValues = x => crypto.getRandomValues(x) + bls = blsSetupFactory(createBlsModule, getRandomValues) } diff --git a/readme.md b/readme.md index 8f7c5cf..79304c4 100644 --- a/readme.md +++ b/readme.md @@ -5,8 +5,6 @@ This module is built with `BLS_ETH=1` for Ethereum 2.0 spec. # News -- 2020/Nov/04 : break backward compatibility (bls.js is renamed to index.js) - - use blsSetupFactory to make bls instance on browser (see the top of bls-demo.js) - 2020/Oct/01 : add `bls.multiVerify` to verify all {sigs, pubs, msgs}. - 2020/Jul/06 ; `setETHmode(bls.ETH_MODE_DRAFT_07)` is default mode - 2020/May/19 : Call `bls.setETHmode(bls.ETH_MODE_DRAFT_07)` once after `bls.init()` for `BLS_ETH_MODE_DRAFT_07` defined at [BLS12381G2_XMD:SHA-256_SSWU_RO_](https://www.ietf.org/id/draft-irtf-cfrg-hash-to-curve-07.html#name-bls12381g2_xmdsha-256_sswu_).