Skip to content

Instantly share code, notes, and snippets.

View clementauger's full-sized avatar
💤

clementauger

💤
  • a rotten planet
View GitHub Profile
@clementauger
clementauger / index.js
Created October 5, 2020 17:26
double ratchet javascript experimentation, adapted from https://github.com/HR/ciphora
const crypto = require('crypto'),
hkdf = require('futoin-hkdf'),
// TODO: Replace with crypto.diffieHellman once nodejs#26626 lands on v12 LTS
{ box } = require('tweetnacl'),
boxutil = require('tweetnacl-util'),
{ chunk, hexToUint8 } = require('./utils'),
CIPHER = 'aes-256-cbc',
RATCHET_KEYS_LEN = 64,
RATCHET_KEYS_HASH = 'SHA-256',