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

Restructure crypto code #191

Open
0x009922 opened this issue Mar 11, 2024 · 2 comments
Open

Restructure crypto code #191

0x009922 opened this issue Mar 11, 2024 · 2 comments
Assignees
Labels
enhancement iroha2 package: client Related to Client package(-s) package: crypto Related to Crypto packages

Comments

@0x009922
Copy link
Contributor

Currently:

  • @iroha2/client contains a crypto singleton, which should be set by users with setCrypto function before using related client functions
  • Each crypto target library (@iroha2/crypto-target-*) exports the same crypto wrap around an actual WASM, a JS layer.
  • @iroha2/crypto-core exports types which are guaranteed to match with crypto's from targets.
  • This is backed by a complex Rollup + TypeScript configuration

Proposal:

  • Move crypto singleton to @iroha2/crypto-core
  • Remove wraps generation for each target. Each target only re-exports raw WASM API as crypto, which is guaranteed to be the same between all the targets.
  • Define the convenient JS layer around raw WASM API once in @iroha2/crypto-core. Make this layer rely on the raw crypto singleton.

Outcomes:

  • Simpler and clearer way of using @iroha2/crypto-*
  • Simpler build configuration
@0x009922 0x009922 added enhancement iroha2 package: client Related to Client package(-s) package: crypto Related to Crypto packages labels Mar 11, 2024
@0x009922
Copy link
Contributor Author

Oh, I created almost the same issue before...

@0x009922 0x009922 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@0x009922
Copy link
Contributor Author

But it was actually not the same. This issue also points out that "interface wrap" could be removed to reduce repetition.

@0x009922 0x009922 reopened this Jun 27, 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`
@0x009922 0x009922 self-assigned this Jun 27, 2024
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