algorand / algorand/js-algorand-sdk

Remove dependency on js-sha256

Open
#697 2 comments 0 reactions 0 assignees View on GitHub
new-feature-request Team Scytale
Dominant language
TypeScript
Stars
297
Forks
214
Avg merge
1h 3m
Merged PRs (30d)
3

Description

## Problem

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

## Solution

Use the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/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)`

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.