Skip to content

randomBytes is required from randombytes which requires from crypto #232

@aki-cat

Description

@aki-cat

I have been having issues with browserified code using this package because it depends on non-browserified code to implement itself.

Basically, this line is the issue:

exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes');

When you require crypto-browserify, you're not using the non-browserified crypto package. But if you go to randombytes' implementation, it requires crypto in its code. This causes two issues:

  1. If you are resolving requires to cryptoas crypto-browserify, you get a circular dependency and the randomBytes field becomes undefined.
  2. If you are not, randombytes will just require regular crypto, which defeats the whole purpose of using a browserified package in the first place. You probably won't have it available in your environment and just end up with nothing in the randomBytes field anyway.

Maybe this is an issue for randombytes instead. But I figured that most packages that depend on randomBytes usually require crypto instead of randombytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions