Skip to content

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

@0x009922

Description

@0x009922

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions