Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
asymmetric-crypto
Advanced tools
Readme
Encryption and signing using public-key cryptography (via
tweetnacl
)
npm install asymmetric-crypto
This module can be used for Node.js as well as browsers using Browserify.
const crypto = require('asymmetric-crypto')
// Generate a key pair
const keyPair = crypto.keyPair()
// -> {
// secretKey: 'KOy7fMWMkRc+QX8dzpfX9VwJKlc/+Zkyw5C7RGTXT920IjiKUdOSe/3sNnrETw7ej9TBFzsPyRfkWGMsGLAufQ==',
// publicKey: 'tCI4ilHTknv97DZ6xE8O3o/UwRc7D8kX5FhjLBiwLn0='
// }
// Regenerate a key pair from the secret key
const newKeyPair = crypto.fromSecretKey(keyPair.secretKey)
// -> {
// secretKey: 'KOy7fMWMkRc+QX8dzpfX9VwJKlc/+Zkyw5C7RGTXT920IjiKUdOSe/3sNnrETw7ej9TBFzsPyRfkWGMsGLAufQ==',
// publicKey: 'tCI4ilHTknv97DZ6xE8O3o/UwRc7D8kX5FhjLBiwLn0='
// }
const myKeyPair = crypto.keyPair()
const theirKeyPair = crypto.keyPair()
// Encrypt data
const encrypted = crypto.encrypt('some data', theirKeyPair.publicKey, myKeyPair.secretKey)
// -> {
// data: '63tP2r8WQuJ+k+jzsd8pbT6WYPHMTafpeg==',
// nonce: 'BDHALdoeBiGg7wJbVdfJhVQQyvpxrBSo'
// }
// Decrypt data
const decrypted = crypto.decrypt(encrypted.data, encrypted.nonce, myKeyPair.publicKey, theirKeyPair.secretKey)
// -> 'some data'
// Sign a message
const message = 'some message'
const signature = crypto.sign(message, myKeyPair.secretKey)
// -> '8oz1aNkSBG1qvYhc+E2VBkgHSxCORGdsyf7LFQuLDmZvJt6vaEzHMIsofmTykMunhCrChEHT9Fgw3sp/W6+7Bw=='
// Verify the signature on a message
const validSignature = crypto.verify(message, signature, myKeyPair.publicKey)
// -> true
npm test
tweetnacl
for the cryptographic implementationtweetnacl-util
for converting into / from stringsed2curve
for converting Ed25519 keys into curve25519-xsalsa20-poly1305 keys (so you can encrypt and sign with the same key pair)fast-memoize
to make converting keys more efficientMIT
Thanks to @pguth for the inspiration. :smile:
FAQs
Encryption and signing using public-key cryptography (via tweetnacl)
The npm package asymmetric-crypto receives a total of 1,811 weekly downloads. As such, asymmetric-crypto popularity was classified as popular.
We found that asymmetric-crypto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.