browserify-rsa icon indicating copy to clipboard operation
browserify-rsa copied to clipboard

Add require on safe-buffer dependency to fix Buffer undefined error when ran in a browser.

Open frelibert opened this issue 1 year ago • 0 comments
trafficstars

This change makes browserify-rsa run in a browser, clientside, which is mainly the purpose of having a browserify module. browserify-rsa depends on Buffer, which is part of Node js API, only available serverside and therefore not available when running in the browser. This can be fixed by adding 'safe-buffer' as dependency and following require statement.

var Buffer = require('safe-buffer').Buffer

This was added to the index.js script, in the same way as allready set in browserify-aes and others.

frelibert avatar Dec 06 '23 12:12 frelibert