Skip to content

Cannot read property 'randomBytes' of undefined #35

@mpetrunic

Description

@mpetrunic

Bcrypto panics when rebuilded by electron.
From my investigation it seems that electron replaces openssl with boressl and this causes some incompatibilities. It seems that requiring of native random passes and doesn't fallback to node version.
I've mitigated it with (ELECTRON env is set by user , not electron itself):

  if(process && process.env.ELECTRON) {
    return require("bcrypto/lib/node/random").randomBytes(length);
  } else {
    return require("bcrypto/lib/random").randomBytes(length);
  }

bcrypto 4.2.8

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