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

Remove dependency on js-sha256 #697

Open
SilentRhetoric opened this issue Nov 28, 2022 · 2 comments
Open

Remove dependency on js-sha256 #697

SilentRhetoric opened this issue Nov 28, 2022 · 2 comments
Labels
new-feature-request Feature request that needs triage Team Scytale

Comments

@SilentRhetoric
Copy link

SilentRhetoric commented Nov 28, 2022

Problem

The old package js-sha256 uses require() and thus causes problems running in a browser context. See issue emn178/js-sha256#33 on the repo suggesting that it be deprecated.

Solution

Use the Web Crypto API or an alternative package that can run in the browser for client-side applications.

Dependencies

Urgency

Using the JS Algo SDK breaks Vite builds. Example error message below:

`undefined:1
require('crypto')
^

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/brianwhippo/Code/alright-solid/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at eval (eval at nodeWrap (file:///Users/name/Code/alright-solid/dist/server-0978c76d.js:30849:19), :1:1)`

@SilentRhetoric SilentRhetoric added the new-feature-request Feature request that needs triage label Nov 28, 2022
@SilentRhetoric SilentRhetoric changed the title Remove dependency on Remove dependency on js-sha256 Nov 28, 2022
@jasonpaulos
Copy link
Contributor

jasonpaulos commented Dec 15, 2022

Based on the limited amount of information here, I believe that error is more likely to be because of the tweetnacl-js library than js-sha256. If that's the case, #707 was recently merged which solves that specific issue. But if you are using this library as a dependency in a browser project, you're also likely to run into #708, which we haven't fixed yet.

@paulmillr
Copy link

#742

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature-request Feature request that needs triage Team Scytale
Projects
None yet
Development

No branches or pull requests

5 participants
@paulmillr @michaeldiamant @jasonpaulos @SilentRhetoric and others