Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Fix issue "Can't resolve 'crypto'" #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

christoph-bittmann
Copy link

@christoph-bittmann christoph-bittmann commented May 19, 2022

To make these library usabled in projects that uses React 17 or higher (see discussion here: https://www.npmjs.com/package/crypto As discussed in #33), I replaced nodes build-in crypto module, that was not meant for the browser, with window.crypto object.
Additionally dependencies was updated and cleaned up, ESLint config and linting errors was fixed.
Finally I also rewrite the unittest for AuthService, because it fails bevore.

@albertwangnz
Copy link

Hi @gardner any updates? Thanks.

}

export const createPKCECodes = (): PKCECodePair => {
const codeVerifier = `${getRandomInt(64, 256)}`
Copy link

@tony19 tony19 Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks like a bug because it only generates a single random number. The original code generates an array of 64 random bytes, and base-64 encodes that.

const codeVerifier = base64URLEncode(randomBytes(64))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants