Move memory helpers to their own module
This commit is contained in:
parent
e77c70ef71
commit
e9ac929b5a
13
index.js
13
index.js
@ -2,24 +2,13 @@
|
||||
|
||||
// Based on https://github.com/dchest/tweetnacl-js/blob/6dcbcaf5f5cbfd313f2dcfe763db35c828c8ff5b/nacl-fast.js.
|
||||
|
||||
var sodium = module.exports
|
||||
|
||||
// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
|
||||
// Public domain.
|
||||
//
|
||||
// Implementation derived from TweetNaCl version 20140427.
|
||||
// See for details: http://tweetnacl.cr.yp.to/
|
||||
|
||||
// also forwarded at the bottom but randombytes is non-enumerable
|
||||
|
||||
sodium.sodium_memzero = function (arr) {
|
||||
arr.fill(0)
|
||||
}
|
||||
|
||||
sodium.sodium_malloc = function (n) {
|
||||
return new Uint8Array(n)
|
||||
}
|
||||
|
||||
forward(require('./memory'))
|
||||
forward(require('./crypto_box'))
|
||||
forward(require('./crypto_generichash'))
|
||||
forward(require('./crypto_hash'))
|
||||
|
Loading…
Reference in New Issue
Block a user