Skip to content

Commit

Permalink
setup bls for browser
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Nov 4, 2020
1 parent e3dcc51 commit e9130b9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
6 changes: 0 additions & 6 deletions bls-demo.js
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
3 changes: 3 additions & 0 deletions bls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 0 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_).
Expand Down

0 comments on commit e9130b9

Please sign in to comment.