dataparty cryptography
- NPM - npmjs.com/package/@dataparty/crypto
- Code - github.com/datapartyjs/dataparty-crypto
- Support - ko-fi/dataparty
It slices, it dices, and it enciphers
- GPU Resistant
- Post-Quantum Ready
- Identity contains:
- TweetNaCL Box & Sign Keys
- Crystal-Kybers KEM Key
- Dilithium Signing Key
- SPHINCS+ Singing Key
- Mnemonic derived keys seed phrases - See example
- bip39 - Phrases are generated using bip39.
- pharses are combined with a password using
argon2
instead of the typicalpbkdf2
- Password derived keys
argon2id
- See examplepbkdf2
- See example - warning this algo is not GPU resistant
Creating 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!