GalaChain / GalaChain/sdk

Remove Node crypto import from chain-api

Open
#638 0 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
TypeScript
Stars
138
Forks
44
Avg merge
1d 16h
Merged PRs (30d)
22

Description

Using `@gala-chain/api` in a client side project and building for production can lead to messages such as:

```
vite v4.5.3 building for production...
[plugin:vite:resolve] Module "node:crypto" has been externalized for browser compatibility, imported by "<...>/node_modules/@gala-chain/api/lib/src/utils/randomUniqueKey.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
```

We're only using it for the `randomBytes` function in `randomUniqueKey()`. This could be replaced by the equivalent function provided in `@noble/secp256k1` (4kb, 0-dependency pure TypeScript library).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.