hyperledger / iroha-javascript

JavaScript library for Iroha, a Distributed Ledger Technology (blockchain) platform.
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
94 stars 64 forks source link

Move WASM singleton from `@iroha2/client` to `@iroha2/crypto-core` #164

Open 0x009922 opened 1 year ago

0x009922 commented 1 year ago

Description

Currently, @iroha2/client provides a mechanism to inject the crypto instance into the library, so that all crypto-related functions will work after that:

import { setCrypto } from '@iroha2/client'
import { crypto } from '@iroha2/crypto-target-node'

setCrypto(crypto)

The proposal is to move this singleton to the @iroha2/crypto-core package, because it seems to make more sense:

import { setCryptoWasm } from '@iroha2/crypto-core'
import { cryptoWasm } from '@iroha2/crypto-target-node'

setCryptoWasm(cryptoWasm)

After that, it will be probably possible to move all "interface wrap" into the single core package, and each crypto-target-* package will be a simple WASM exporter

Benefits

Drawbacks

There might be some unexpected limitations, needs research.