Socket
Socket
Sign inDemoInstall

sodium-native

Package Overview
Dependencies
Maintainers
1
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 0.0.0 to 0.0.1

example.js

23

index.js
var bindings = require('bindings')
var sodium = bindings('sodium')
var pk = new Buffer(sodium.crypto_sign_PUBLICKEYBYTES)
var sk = new Buffer(sodium.crypto_sign_SECRETKEYBYTES)
var seed = new Buffer(sodium.crypto_sign_SEEDBYTES).fill('yolo')
console.log('crypto_sign_seed_keypair()', sodium.crypto_sign_seed_keypair(pk, sk, seed))
var message = new Buffer('Hello, World!')
var signedMessage = new Buffer(sodium.crypto_sign_BYTES + message.length)
console.log('crypto_sign()', sodium.crypto_sign(signedMessage, message, sk))
var rawMessage = new Buffer(message.length)
console.log('crypto_sign_open()', sodium.crypto_sign_open(rawMessage, signedMessage, pk))
console.log('-->', rawMessage.toString())
var rawSignature = new Buffer(sodium.crypto_sign_BYTES)
console.log('crypto_sign_detached()', sodium.crypto_sign_detached(rawSignature, message, sk))
console.log('crypto_sign_verify_detached()', sodium.crypto_sign_verify_detached(rawSignature, message, pk))
module.exports = sodium
{
"name": "sodium-native",
"version": "0.0.0",
"version": "0.0.1",
"description": "Low level bindings for libsodium (WIP, THERE BE DRAGONS).",

@@ -5,0 +5,0 @@ "main": "index.js",

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