Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.01 KB

README.md

File metadata and controls

50 lines (36 loc) · 1.01 KB

Zk Crypto

NPM Wrap for zkbnb-js-sdk.

Usage

> npm i @bnb-chain/greenfield-zk-crypto

Browsers

ESM

import {getEddsaCompressedPublicKey} from "@bnb-chain/greenfield-zk-crypto"

// set wasm path: CDN or your server path
window.__PUBLIC_ZKCRYPTO_WASM_PATH__ = 'zk wasm path';

;(async () => {
  const res = await getEddsaCompressedPublicKey('foo');
  console.log(res)
})()

UMD

<script src="https://cdn.jsdelivr.net/npm/@bnb-chain/greenfield-zk-crypto/dist/umd/index.js"></script>
<script>
  // set wasm path
  window.__PUBLIC_CROSS_WASM_PATH__ = 'https://cdn.jsdelivr.net/npm/@bnb-chain/greenfield-zk-crypto/dist/node/zk-crypto.wasm';

  ;(async () => {
    const res = await getEddsaCompressedPublicKey('foo');
    console.log(res)
  })()
</script>

Nodejs

const { getEddsaCompressedPublicKey } = require("@bnb-chain/greenfield-zk-crypto");

;(async () => {
  const res = await getEddsaCompressedPublicKey('foo');
})()