Skip to content

AI-written fix to crypto-rng TypeError in recent NodeJS#20

Open
resonant-riches wants to merge 1 commit intolukebuehler:mainfrom
ChorusOne:fix-nodejs-22-crypto-compatibility
Open

AI-written fix to crypto-rng TypeError in recent NodeJS#20
resonant-riches wants to merge 1 commit intolukebuehler:mainfrom
ChorusOne:fix-nodejs-22-crypto-compatibility

Conversation

@resonant-riches
Copy link
Contributor

Hopefully fixes #17

Written by Claude Code because I don't understand NodeJS well enough to do it myself.

Claude's comments below:


The up8-ticket dependency was calling crypto.rng() which doesn't exist in Node.js (it has crypto.randomBytes() instead). This caused network-key generation commands to fail with "TypeError: crypto.rng is not a function".

Applied a patch using patch-package that adds crypto.rng as an alias to crypto.randomBytes in the up8-ticket module. This fix is automatically applied on npm install via the postinstall script.

Also removed redundant workarounds from network-key.js, wallet.js, and cli.js that were incomplete.

The up8-ticket dependency was calling crypto.rng() which doesn't exist
in Node.js (it has crypto.randomBytes() instead). This caused network-key
generation commands to fail with "TypeError: crypto.rng is not a function".

Applied a patch using patch-package that adds crypto.rng as an alias to
crypto.randomBytes in the up8-ticket module. This fix is automatically
applied on npm install via the postinstall script.

Also removed redundant workarounds from network-key.js, wallet.js, and
cli.js that were incomplete.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: crypto.rng is not a function

1 participant