@vocdoni/encryption contains encryption helpers for the dvote-js library
Use npm to install @vocdoni/encryption.
npm install @vocdoni/encryption
import { Asymmetric } from "@vocdoni/encryption"
// See also: Asymmetric.encryptBytes, Asymmetric.encryptRaw
const encrypted = Asymmetric.encryptString("super secret", publicKey)
const decrypted = Asymmetric.decryptString(encrypted, privateKey)
console.log(decrypted)
// Prints "super secret
import { Asymmetric } from "@vocdoni/encryption"
// See also: Symmetric.encryptBytes, Symmetric.encryptRaw
const encrypted = Symmetric.encryptString("super secret", "my-passphrase")
const decrypted = Symmetric.decryptString(encrypted, "my-passphrase")
console.log(decrypted)
// Prints "super secret
To execute library tests just run
npm run test