Socket
Socket
Sign inDemoInstall

envelope-js

Package Overview
Dependencies
Maintainers
18
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envelope-js - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

4

package.json
{
"name": "envelope-js",
"description": "new private message format for ssb",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/ssbc/envelope-js",

@@ -21,3 +21,3 @@ "repository": {

"sodium-native": "^3.2.0",
"ssb-bfe": "^1.0.0"
"ssb-bfe": "^2.0.1"
},

@@ -24,0 +24,0 @@ "devDependencies": {

@@ -1,31 +0,25 @@

const { bfeNamedTypes } = require('ssb-bfe')
const { toTF } = require('ssb-bfe')
const error = require('./error')
const GENERIC = bfeNamedTypes['generic']
const NIL_TFD = Buffer.from([GENERIC.code, GENERIC.formats['nil'].code])
const NIL_TFD = toTF('generic', 'nil')
const FEED = bfeNamedTypes['feed']
const CLASSIC_FEED_TF = Buffer.from([FEED.code, FEED.formats['ssb/classic'].code])
const GABBYGR_FEED_TF = Buffer.from([FEED.code, FEED.formats['ssb/gabby-grove'].code])
const BENDYBT_FEED_TF = Buffer.from([FEED.code, FEED.formats['ssb/bendy-butt'].code])
const CLASSIC_FEED_TF = toTF('feed', 'classic')
const GABBYGR_FEED_TF = toTF('feed', 'gabby-grove')
const BENDYBT_FEED_TF = toTF('feed', 'bendy-butt')
const MSG = bfeNamedTypes['msg']
const CLASSIC_MSG_TF = Buffer.from([MSG.code, MSG.formats['ssb/classic'].code])
const GABBYGR_MSG_TF = Buffer.from([MSG.code, MSG.formats['ssb/gabby-grove'].code])
const BENDYBT_MSG_TF = Buffer.from([MSG.code, MSG.formats['ssb/bendy-butt'].code])
const CLASSIC_MSG_TF = toTF('msg', 'classic')
const GABBYGR_MSG_TF = toTF('msg', 'gabby-grove')
const BENDYBT_MSG_TF = toTF('msg', 'bendy-butt')
module.exports = function convertBFENilMsg(msgTFD, feedTFK) {
if (msgTFD.equals(NIL_TFD)) {
const feedTF = feedTFK.slice(0, 2)
if (feedTF.equals(BENDYBT_FEED_TF))
return Buffer.concat([BENDYBT_MSG_TF, Buffer.alloc(32)])
else if (feedTF.equals(GABBYGR_FEED_TF))
return Buffer.concat([GABBYGR_MSG_TF, Buffer.alloc(32)])
else if (feedTF.equals(CLASSIC_FEED_TF))
return Buffer.concat([CLASSIC_MSG_TF, Buffer.alloc(32)])
else
throw error('Unknown feed type', feedTF)
} else
return msgTFD
const ZEROS = Buffer.alloc(32)
module.exports = function convertBFENilMsg (msgTFD, feedTFK) {
if (!msgTFD.equals(NIL_TFD)) return msgTFD
const feedTF = feedTFK.slice(0, 2)
if (feedTF.equals(CLASSIC_FEED_TF)) return Buffer.concat([CLASSIC_MSG_TF, ZEROS])
if (feedTF.equals(GABBYGR_FEED_TF)) return Buffer.concat([GABBYGR_MSG_TF, ZEROS])
if (feedTF.equals(BENDYBT_FEED_TF)) return Buffer.concat([BENDYBT_MSG_TF, ZEROS])
throw error('Unknown feed type', feedTF)
}

@@ -11,3 +11,3 @@ /* eslint-disable camelcase */

module.exports = function DeriveSecret (feed_id, prev_msg_id) {
prev_msg_id = convertBFENilMsg(prev_msg_id, feed_id)
const prevMsgId = convertBFENilMsg(prev_msg_id, feed_id)

@@ -18,3 +18,3 @@ return function derive (pk, labels, length = key_length) {

feed_id,
prev_msg_id,
prevMsgId,
...(labels.map(toBuffer))

@@ -21,0 +21,0 @@ ]

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc