tweetnacl-js | Port of TweetNaCl cryptographic library to JavaScript | Cryptography library
kandi X-RAY | tweetnacl-js Summary
kandi X-RAY | tweetnacl-js Summary
The primary goal of this project is to produce a translation of TweetNaCl to JavaScript which is as close as possible to the original C implementation, plus a thin layer of idiomatic high-level API on top of it.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Loops over a hash .
- This function is called from KDF2
- The HAB - specific function for the given key .
- Calculate NaN
- Core core implementation
- Cryptographically hash .
- unpack negation .
- Generates a sign signature
- Cryptographically hash blocks .
- Open sign and sign a signature .
tweetnacl-js Key Features
tweetnacl-js Examples and Code Snippets
Community Discussions
Trending Discussions on tweetnacl-js
QUESTION
I'm using the swift-sodium library and need a 32 bytes long UInt8 array (public key) to seal a message. However, the public key which is generated by the tweetnacl-js library that I got from an api is a 44 bytes long base64 string. How do I convert the 44 bytes long base64 public key to a 32 bytes long UInt8 array so I can pass it to the seal function?
...ANSWER
Answered 2022-Feb-09 at 11:02You can convert your Base64-String using the following example:
QUESTION
I am trying to understand how to implement a minimal basic Public-key signature example based on the demo located here, using pure javascript.
My research has not yielded a simple javascript example that I can use to understand its inner workings, and the documentation is over my head at the moment.
I tried looking at the source code of the demo, but it is not revealing its secrets.
The library's examples does not have an example for this either.
Cryptography is something very new to me, so any baseline example of how to create their Public-key example with pure javascript in node.js would be greatly appreciated!
Pseudocode-ish:
...ANSWER
Answered 2020-Nov-11 at 09:16TweetNaCl.js is a port to JavaScript of TweetNaCl. TweetNacl in turn is a compact implementation of NaCl, which provides various encryption and signature algorithms essentially based on Curve25519. There are NaCl-compatible implementations or wrappers for many platforms, so that any of these documentations can be used for an introduction, e.g. the clear documentation of the Libsodium fork.
The documentation of TweetNaCl.js also gives a short overview of the functionality: nacl.sign(message, secretKey)
creates a signed message consisting of the 64 bytes signature with attached message. nacl.sign.open(signedMessage, publicKey)
verifies the message using the signature and returns the message if verification is successful. The algorithm used for signing is Ed25519.
As already noted in the comments, you do not distinguish clearly between encryption (purpose: secrecy) and signing (purpose: authentication / integrity). In particular, secrecy of the message is not the purpose of signing. This becomes apparent e.g. when the return of nacl.sign()
contains the unencrypted message (see code snippet below). However, it is true that encryption with the private key is performed during signing (but not for the purpose of keeping it secret).
The following implementation is a pure JavaScript implementation:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tweetnacl-js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page