Socket
Socket
Sign inDemoInstall

sodium-native

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sodium-native - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

prebuilds/darwin-x64/node-67.node

13

CHANGELOG.md
# CHANGELOG
## Next
* Updated cross-references to libsodium documentation (thanks @stripedpajamas)
* Fix documentation typo (thanks @ralphtheninja)
* Fix [DEP0005] DeprecationWarning: `Buffer()` (thanks @ralphtheninja)
* Upgrade and be compliant with standard@12
* Improve robustness of Windows builds. This means that we now use the "best"
possible MSBuild. Thank you for all the work @enko
* Due to the previous effort we can now build all artefacts on Travis and their
new Windows offering
* Amend the new MSBuild finding algorithm to look for "Program Files (x86)"
first, such that cross-compiling works
## v2.2.3

@@ -4,0 +17,0 @@

2

example.js

@@ -9,3 +9,3 @@ var sodium = require('./')

sodium.randombytes_buf(nonce) // insert random data into nonce
sodium.randombytes_buf(key) // insert random data into key
sodium.randombytes_buf(key) // insert random data into key

@@ -12,0 +12,0 @@ // encrypted message is stored in cipher.

{
"name": "sodium-native",
"version": "2.2.3",
"version": "2.2.4",
"description": "Low level bindings for libsodium",

@@ -16,3 +16,3 @@ "main": "index.js",

"sodium-vectors": "^1.0.0",
"standard": "^8.6.0",
"standard": "^12.0.1",
"tape": "^4.6.3"

@@ -19,0 +19,0 @@ },

@@ -56,5 +56,5 @@ var os = require('os')

if (err) throw err
proc.exec('install_name_tool -id "@loader_path/libsodium.dylib" libsodium.dylib', {cwd: build}, function (err) {
proc.exec('install_name_tool -id "@loader_path/libsodium.dylib" libsodium.dylib', { cwd: build }, function (err) {
if (err) throw err
proc.exec('install_name_tool -change "' + lib + '" "@loader_path/libsodium.dylib" sodium.node', {cwd: build}, function (err) {
proc.exec('install_name_tool -change "' + lib + '" "@loader_path/libsodium.dylib" sodium.node', { cwd: build }, function (err) {
if (err) throw err

@@ -61,0 +61,0 @@ })

@@ -62,2 +62,34 @@ #!/usr/bin/env node

function findMsBuild () {
var possiblePathSuffixes = [
'/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/msbuild.exe',
'/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/msbuild.exe',
'/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/msbuild.exe',
'/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/msbuild.exe',
'/MSBuild/14.0/Bin/MSBuild.exe',
'/MSBuild/12.0/Bin/MSBuild.exe'
]
// First try X86 paths (on 64 bit machine which is most likely) then 32 bit
var possiblePaths = possiblePathSuffixes.map(p => process.env['PROGRAMFILES(X86)'] + p)
.concat(possiblePathSuffixes.map(p => process.env['PROGRAMFILES'] + p))
possiblePaths.push(process.env.WINDIR + '/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe')
for (var counter = 0; counter < possiblePaths.length; counter++) {
var possiblePath = path.resolve(possiblePaths[counter])
try {
fs.accessSync(possiblePath)
return possiblePath
} catch (error) {
// Binary not found checking next path
}
}
console.error('MSBuild not found')
console.error('You can run "npm install --global --production windows-build-tools" to fix this.')
process.exit(1)
}
function buildWindows () {

@@ -67,7 +99,7 @@ var res = path.join(__dirname, 'lib/libsodium-' + arch + '.dll')

spawn('.\\msvc-scripts\\process.bat', [], {cwd: dir, stdio: 'inherit'}, function (err) {
spawn('.\\msvc-scripts\\process.bat', [], { cwd: dir, stdio: 'inherit' }, function (err) {
if (err) throw err
var msbuild = path.resolve('/', 'Program Files (x86)', 'MSBuild/14.0/Bin/MSBuild.exe')
var msbuild = findMsBuild()
var args = ['/p:Configuration=ReleaseDLL;Platform=' + warch, '/nologo']
spawn(msbuild, args, {cwd: dir, stdio: 'inherit'}, function (err) {
spawn(msbuild, args, { cwd: dir, stdio: 'inherit' }, function (err) {
if (err) throw err

@@ -88,7 +120,7 @@

spawn('./configure', ['--prefix=' + tmp], {cwd: __dirname, stdio: 'inherit'}, function (err) {
spawn('./configure', ['--prefix=' + tmp], { cwd: __dirname, stdio: 'inherit' }, function (err) {
if (err) throw err
spawn('make', ['clean'], {cwd: dir, stdio: 'inherit'}, function (err) {
spawn('make', ['clean'], { cwd: dir, stdio: 'inherit' }, function (err) {
if (err) throw err
spawn('make', ['install'], {cwd: dir, stdio: 'inherit'}, function (err) {
spawn('make', ['install'], { cwd: dir, stdio: 'inherit' }, function (err) {
if (err) throw err

@@ -111,3 +143,3 @@

if (err) throw err
spawn('install_name_tool', ['-id', res, res], {stdio: 'inherit'}, function (err) {
spawn('install_name_tool', ['-id', res, res], { stdio: 'inherit' }, function (err) {
if (err) throw err

@@ -114,0 +146,0 @@ })

# sodium-native
[![build status](https://travis-ci.org/sodium-friends/sodium-native.svg?branch=master)](https://travis-ci.org/sodium-friends/sodium-native)

@@ -9,6 +10,2 @@ Low level bindings for [libsodium](https://github.com/jedisct1/libsodium).

[![build status](https://travis-ci.org/sodium-friends/sodium-native.svg?branch=master)](https://travis-ci.org/sodium-friends/sodium-native)
[![build status](https://ci.appveyor.com/api/projects/status/8wi3my2clf1ami6k/branch/master?svg=true)](https://ci.appveyor.com/project/mafintosh/sodium-native/branch/master)
The goal of this project is to be thin, stable, unopionated wrapper around libsodium.

@@ -61,3 +58,3 @@

Bindings to the secure memory API.
[See the libsodium "Securing memory allocations" docs for more information](https://download.libsodium.org/doc/helpers/memory_management.html).
[See the libsodium "Securing memory allocations" docs for more information](https://download.libsodium.org/doc/memory_management).

@@ -78,3 +75,3 @@ #### `sodium.sodium_memzero(buffer)`

Allocate a buffer of `size` which is memory protected. See [libsodium docs](https://download.libsodium.org/doc/helpers/memory_management.html#guarded-heap-allocations) for details. Be aware that many Buffer methods may break the security guarantees of `sodium.sodium_malloc`'ed memory. To check if a `Buffer` is a "secure" buffer,
Allocate a buffer of `size` which is memory protected. See [libsodium docs](https://download.libsodium.org/doc/memory_management#guarded-heap-allocations) for details. Be aware that many Buffer methods may break the security guarantees of `sodium.sodium_malloc`'ed memory. To check if a `Buffer` is a "secure" buffer,
you can call access the getter `buffer.secure` which will be `true`.

@@ -123,3 +120,3 @@

Bindings to various helper functions.
[See the libsodium padding docs for more information](https://download.libsodium.org/doc/helpers/).
[See the libsodium helpers docs for more information](https://download.libsodium.org/doc/helpers/).

@@ -172,3 +169,3 @@ ### `var bool = sodium.sodium_memcmp(b1, b2)`

Bindings to the padding API.
[See the libsodium padding docs for more information](https://download.libsodium.org/doc/helpers/padding.html).
[See the libsodium padding docs for more information](https://download.libsodium.org/doc/padding).

@@ -199,3 +196,3 @@ #### `var paddedLength = sodium.sodium_pad(buf, unpaddedLength, blocksize)`

Bindings for the crypto_sign API.
[See the libsodium crypto_sign docs for more information](https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html).
[See the libsodium crypto_sign docs for more information](https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures).

@@ -277,3 +274,3 @@ #### `crypto_sign_seed_keypair(publicKey, secretKey, seed)`

Bindings for the crypto_generichash API.
[See the libsodium crypto_generichash docs for more information](https://download.libsodium.org/doc/hashing/generic_hashing.html).
[See the libsodium crypto_generichash docs for more information](https://download.libsodium.org/doc/hashing/generic_hashing).

@@ -320,3 +317,3 @@ #### `crypto_generichash(output, input, [key])`

Bindings for the crypto_box API.
[See the libsodium crypto_box docs for more information](https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption.html).
[See the libsodium crypto_box docs for more information](https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption).

@@ -399,3 +396,3 @@ #### `crypto_box_seed_keypair(publicKey, secretKey, seed)`

Bindings for the crypto_box_seal API.
[See the libsodium crypto_box_seal docs for more information](https://download.libsodium.org/doc/public-key_cryptography/sealed_boxes.html).
[See the libsodium crypto_box_seal docs for more information](https://download.libsodium.org/doc/public-key_cryptography/sealed_boxes).

@@ -431,3 +428,3 @@ Keypairs can be generated with `crypto_box_keypair()` or `crypto_box_seed_keypair()`.

Bindings for the crypto_secretbox API.
[See the libsodium crypto_secretbox docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/authenticated_encryption.html).
[See the libsodium crypto_secretbox docs for more information](https://download.libsodium.org/doc/public-key_cryptography/authenticated_encryption).

@@ -485,3 +482,3 @@ #### `crypto_secretbox_detached(ciphertext, mac, message, nonce, secretKey)`

Bindings for the crypto_aead_* APIs.
[See the libsodium AEAD docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/aead.html).
[See the libsodium AEAD docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/aead).

@@ -579,3 +576,3 @@ Currently only `crypto_aead_xchacha20poly1305_ietf` is exposed.

Bindings for the crypto_stream API.
[See the libsodium crypto_stream docs for more information](https://download.libsodium.org/doc/advanced/xsalsa20.html).
[See the libsodium crypto_stream docs for more information](https://download.libsodium.org/doc/advanced/stream_ciphers/xsalsa20).

@@ -627,3 +624,3 @@ #### `crypto_stream(ciphertext, nonce, key)`

Bindings for the crypto_auth API.
[See the libsodium crypto_auth docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/secret-key_authentication.html).
[See the libsodium crypto_auth docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/secret-key_authentication).

@@ -653,3 +650,3 @@ #### `crypto_auth(output, input, key)`

Bindings for the crypto_secretstream API.
[See the libsodium crypto_secretstream docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/secretstream.html).
[See the libsodium crypto_secretstream docs for more information](https://download.libsodium.org/doc/secret-key_cryptography/secretstream).

@@ -740,3 +737,3 @@ ### Constants

Bindings for the crypto_onetimeauth API.
[See the libsodium crypto_onetimeauth docs for more information](https://download.libsodium.org/doc/advanced/poly1305.html).
[See the libsodium crypto_onetimeauth docs for more information](https://download.libsodium.org/doc/advanced/poly1305).

@@ -907,3 +904,3 @@ #### `crypto_onetimeauth(output, input, key)`

Bindings for the crypto_scalarmult API.
[See the libsodium crypto_scalarmult docs for more information](https://download.libsodium.org/doc/advanced/scalar_multiplication.html).
[See the libsodium crypto_scalarmult docs for more information](https://download.libsodium.org/doc/advanced/point-arithmetic#scalar-multiplication).

@@ -932,3 +929,3 @@ #### `crypto_scalarmult_base(publicKey, secretKey)`

Bindings for the crypto_core_ed25519 and crypto_co_ed25519 API.
[See the libsodium crypto_core_ed25519 docs for more information](https://download.libsodium.org/doc/advanced/point-arithmetic.html).
[See the libsodium crypto_core_ed25519 docs for more information](https://download.libsodium.org/doc/advanced/point-arithmetic).

@@ -1006,3 +1003,3 @@ #### Constants

Bindings for the crypto_shorthash API.
[See the libsodium crypto_shorthash docs for more information](https://download.libsodium.org/doc/hashing/short-input_hashing.html).
[See the libsodium crypto_shorthash docs for more information](https://download.libsodium.org/doc/hashing/short-input_hashing).

@@ -1009,0 +1006,0 @@ #### `crypto_shorthash(output, input, key)`

@@ -14,3 +14,3 @@ var tape = require('tape')

t.throws(function () {
sodium.crypto_box_seed_keypair(new Buffer(0), new Buffer(0), new Buffer(0))
sodium.crypto_box_seed_keypair(Buffer.alloc(0), Buffer.alloc(0), Buffer.alloc(0))
}, 'should validate input length')

@@ -42,3 +42,3 @@

t.throws(function () {
sodium.crypto_box_keypair(new Buffer(0), new Buffer(0))
sodium.crypto_box_keypair(Buffer.alloc(0), Buffer.alloc(0))
}, 'should validate input length')

@@ -56,3 +56,3 @@

var message = new Buffer('Hello, World!')
var message = Buffer.from('Hello, World!')
var mac = Buffer.alloc(sodium.crypto_box_MACBYTES)

@@ -80,3 +80,3 @@ var cipher = Buffer.alloc(message.length)

var message = new Buffer('Hello, World!')
var message = Buffer.from('Hello, World!')
var cipher = Buffer.alloc(message.length + sodium.crypto_box_MACBYTES)

@@ -107,3 +107,3 @@

var message = new Buffer('Hello, sealed World!')
var message = Buffer.from('Hello, sealed World!')
var cipher = Buffer.alloc(message.length + sodium.crypto_box_SEALBYTES)

@@ -110,0 +110,0 @@

@@ -14,3 +14,3 @@ var tape = require('tape')

t.throws(function () {
sodium.crypto_kx_seed_keypair(new Buffer(0), new Buffer(0), new Buffer(0))
sodium.crypto_kx_seed_keypair(Buffer.alloc(0), Buffer.alloc(0), Buffer.alloc(0))
}, 'should validate input length')

@@ -42,3 +42,3 @@

t.throws(function () {
sodium.crypto_kx_keypair(new Buffer(0), new Buffer(0))
sodium.crypto_kx_keypair(Buffer.alloc(0), Buffer.alloc(0))
}, 'should validate input length')

@@ -45,0 +45,0 @@

@@ -0,1 +1,2 @@

/* eslint-disable */
var sodium = require('../..')

@@ -2,0 +3,0 @@ var buf = sodium.sodium_malloc(1)

@@ -0,1 +1,2 @@

/* eslint-disable */
var sodium = require('../..')

@@ -2,0 +3,0 @@ var buf = sodium.sodium_malloc(1)

@@ -0,1 +1,2 @@

/* eslint-disable */
var sodium = require('../..')

@@ -2,0 +3,0 @@ var buf = sodium.sodium_malloc(1)

@@ -45,3 +45,3 @@ var tape = require('tape')

t.ok(small.length === 1, 'has correct size')
t.same(small, Buffer([0xdb]), 'has canary content')
t.same(small, Buffer.from([0xdb]), 'has canary content')
t.ok(large.length === 1e8, 'has correct size')

@@ -48,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc