Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@dataparty/crypto
Advanced tools
Readme
dataparty cryptography
It slices, it dices, and it enciphers
argon2id
- See examplepbkdf2
- See example - warning outdateCreating a random key pair
const dataparty_crypto = require('@dataparty/crypto')
const alice = new dataparty_crypto.Identity({id:'alice'})
const bob = new dataparty_crypto.Identity({id:'bob'})
let encryptedMessage = new dataparty_crypto.Message({
msg: {
data: 'hello world'
}
})
//! Bob encrypts the message
await encryptedMessage.encrypt(bob, alice.toMini())
sendToAlice( encryptedMessage.toJSON() )
//! Later alice decrypt a message
const decryptedMessage = new dataparty_crypto.Message(msgFromBob)
await decryptedMessage.decrypt(alice)
console.log(`alice read: ${JSON.stringify(decryptedMessage.msg,null,2)}`)
//! Another way to verify that bob sent the message
await decryptedMessage.assertVerified(bob)
//! Alice signs a message
const signedMsg = await alice.sign({a:'hello world'})
sendToAlice( signedMsg.toJSON() )
const signedMsg = new dataparty_crypto.Message(msfFromAlice)
//! Verify that Alice sent the message
const verified = await alice.verify(signedMsg)
console.log('verified?', verified)
//! Another way to verify that alice sent the message
await signedMsg.assertVerified(alice)
const password = 'super-strong-password'
const salt = await dataparty_crypto.Routines.generateSalt() //! Salt would be read from disk after 1st run
const key = await dataparty_crypto.Routines.createKeyFromPasswordArgon2(
argon2,
"supersecretpassword123",
salt
)
const phrase = await dataparty_crypto.Routines.generateMnemonic()
let key = await dataparty_crypto.Routines.createKeyFromMnemonic(phrase)
npm build
npm watch
npm test
Buy us a coffee!
FAQs
dataparty crypto routines
The npm package @dataparty/crypto receives a total of 1 weekly downloads. As such, @dataparty/crypto popularity was classified as not popular.
We found that @dataparty/crypto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
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.