0.1.95 • Published 1 year ago

@litprotocol/bls-sdk v0.1.95

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Installation

yarn add @litprotocol/bls-sdk

Usage

import { initWasmBlsSdk } from '@litprotocol/bls-sdk';

initWasmBlsSdk().then((exports) => {
  globalThis.wasmExports = exports;
  log(
    `✅ [BLS SDK] wasmExports loaded. ${
      Object.keys(exports).length
    } functions available. Run 'wasmExports' in the console to see them.`
  );
});

Then

// set decryption shares bytes in wasm
decryptionShares.forEach((s: any, idx: any) => {

    wasmExports.set_share_indexes(idx, s.shareIndex);

    const shareAsBytes = uint8arrayFromString(s.decryptionShare, 'base16');

    for (let i = 0; i < shareAsBytes.length; i++) {
        wasmExports.set_decryption_shares_byte(i, idx, shareAsBytes[i]);
    }
});