🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

blind-encryption-sodium

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blind-encryption-sodium

Implemention of encryption encoding for Autobase blind encryption using sodium easy box

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
2
Created
Source

blind-encryption-sodium

Implemention of encryption encoding for Autobase blind encryption using sodium easy box

Usage

const BlindEncryptionSodium = require('blind-encryption-sodium')
const b4a = require('b4a')

const key = b4a.alloc(32) // 32-byte key

const encryption = new BlindEncryptionSodium(key)

const encrypted = await encryption.encrypt(plaintext)
// { value: <Buffer>, type: 1 }

const { value, rotated } = await encryption.decrypt(encrypted)

// if rotated, it was decrypted with a newer type, and you should encrypt and store

Multiple values can be passed in. This enables you to "rotate" entropies.

  • Value encrypted with an entropy will be decoded with the old entropy automatically
  • Old types are no longer needed after upgrade
  • Returns if rotated when decrypting. Note: if it was decrypted with a newer entropy, you should encrypt and store to ensure it uses your latest entropy

Usage with Autobase:

const base = new Autobase(store, {
  apply,
  open,
  encryptionKey,
  blindEncryption: new BlindEncryptionSodium(newKey, oldKey)
})

Usage with encryption-encoding

Internally, Autobase uses this with encryption-encoding

const { encrypt, decrypt } = require('encryption-encoding')
const BlindEncryptionSodium = require('blind-encryption-sodium')

const encryptedAndEncoded = await encrypt(encryptionKey, bes.encrypt.bind(bes))
const decrypted = await decrypt(encryptedAndEncoded, bes.decrypt.bind(bes))

License

Apache-2.0

Keywords

pear

FAQs

Package last updated on 22 Jan 2026

Did you know?

Socket

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.

Install

Related posts