Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
0x009922 opened this issue May 15, 2023 · 0 comments
Open

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

0x009922 opened this issue May 15, 2023 · 0 comments
Assignees
Labels
enhancement iroha2 package: client Related to Client package(-s) package: crypto Related to Crypto packages

Comments

@0x009922
Copy link
Contributor

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

  • More intuitive API: the crypto part is moved to the crypto package
  • Simpler code base - no complicated wrap bundling for each target

Drawbacks

There might be some unexpected limitations, needs research.

@0x009922 0x009922 added enhancement iroha2 package: client Related to Client package(-s) package: crypto Related to Crypto packages labels May 15, 2023
@0x009922 0x009922 self-assigned this May 15, 2023
@0x009922 0x009922 removed their assignment Mar 11, 2024
@0x009922 0x009922 self-assigned this Jun 13, 2024
0x009922 added a commit to 0x009922/iroha-javascript that referenced this issue Jun 27, 2024
…edger-iroha#191)

- move singleton to `crypto-core`
- remove duplicated "wraps" from `crypto-target-*`, write it once in `crypto-core`
- remove dependency on `data-model` from `crypto-core`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement iroha2 package: client Related to Client package(-s) package: crypto Related to Crypto packages
Projects
None yet
Development

No branches or pull requests

1 participant