Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.0 to 1.1.1

52

.eslintrc.js
module.exports = {
'env': {
'browser': true,
'commonjs': true,
'es6': true
env: {
browser: true,
commonjs: true,
es6: true
},
'extends': 'eslint:recommended',
'globals': {
'Atomics': 'readonly',
'Buffer': 'readonly',
'SharedArrayBuffer': 'readonly'
extends: 'eslint:recommended',
globals: {
Atomics: 'readonly',
Buffer: 'readonly',
SharedArrayBuffer: 'readonly'
},
'parserOptions': {
'ecmaVersion': 2018
parserOptions: {
ecmaVersion: 2018
},
'rules': {
rules: {
'accessor-pairs': 'error',

@@ -27,4 +27,4 @@ 'array-bracket-newline': 'error',

{
'after': true,
'before': true
after: true,
before: true
}

@@ -36,3 +36,3 @@ ],

'callback-return': 'error',
'camelcase': 'off',
camelcase: 'off',
'capitalized-comments': 'off',

@@ -44,12 +44,12 @@ 'class-methods-use-this': 'error',

{
'after': true,
'before': false
after: true,
before: false
}
],
'comma-style': 'error',
'complexity': 'error',
complexity: 'error',
'computed-property-spacing': 'error',
'consistent-return': 'off',
'consistent-this': 'error',
'curly': 'off',
curly: 'off',
'default-case': 'error',

@@ -60,3 +60,3 @@ 'default-param-last': 'error',

'eol-last': 'error',
'eqeqeq': 'error',
eqeqeq: 'error',
'func-call-spacing': 'error',

@@ -76,3 +76,3 @@ 'func-name-matching': 'error',

'implicit-arrow-linebreak': 'error',
'indent': 'off',
indent: 'off',
'indent-legacy': 'off',

@@ -229,7 +229,7 @@ 'init-declarations': 'error',

'quote-props': 'off',
'quotes': [
quotes: [
'error',
'single'
],
'radix': 'error',
radix: 'error',
'require-atomic-updates': 'error',

@@ -240,3 +240,3 @@ 'require-await': 'error',

'rest-spread-spacing': 'error',
'semi': 'off',
semi: 'off',
'semi-spacing': 'error',

@@ -259,3 +259,3 @@ 'semi-style': 'error',

],
'strict': [
strict: [
'error',

@@ -277,4 +277,4 @@ 'never'

'yield-star-spacing': 'error',
'yoda': 'error'
yoda: 'error'
}
}

@@ -0,1 +1,2 @@

/* eslint-disable camelcase */
const { Buffer } = require('buffer')

@@ -23,10 +24,10 @@ const na = require('sodium-native')

const offset = (
32 + // header_box
recp_keys.length * 32 // key_slots
// ?? // TODO - extensions section
32 + // // header_box
recp_keys.length * 32 // key_slots
// ?? // TODO - extensions section
)
const ciphertext = Buffer.alloc(
offset + // length of bytes before body_box
plain_text.length + 16 // body_box = body + HMAC
offset + // length of bytes before body_box
plain_text.length + 16 // body_box = body + HMAC
)

@@ -45,7 +46,6 @@

/* key_slots */
const { slot } = KeySlot(derive)
recp_keys.forEach((recp, i) => {
slot(ciphertext.slice(32 + 32*i, 64 + 32*i), msg_key, recp)
slot(ciphertext.slice(32 + 32 * i, 64 + 32 * i), msg_key, recp)
})

@@ -57,3 +57,2 @@

/* body_box */

@@ -60,0 +59,0 @@ const body_box = ciphertext.slice(offset)

@@ -0,1 +1,2 @@

/* eslint-disable camelcase */
const na = require('sodium-native')

@@ -19,3 +20,3 @@ const hkdf = require('futoin-hkdf')

var info = [
const info = [
Buffer.from(labels.cloaked_msg_id, 'utf8'),

@@ -22,0 +23,0 @@ public_msg_id

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

@@ -12,5 +12,4 @@ "repository": {

"generate": "rm test/generate/vectors/* && node test/generate/index.js",
"test": "npm run test:js",
"test:js": "tape test/*.test.js",
"test:pretty": "npm run test:js | tap-spec && npm run lint",
"test": "npm run test:js && npm run lint",
"test:js": "tape test/*.test.js | tap-spec",
"lint": "eslint ."

@@ -17,0 +16,0 @@ },

@@ -27,3 +27,3 @@ # envelope-js

- `key` *Buffer* is the key the particular recipient
- `scheme` *String* is the type of key / the key management scheme for this recipient
- `scheme` *String|Buffer* is the type of key / the key management scheme for this recipient

@@ -39,3 +39,3 @@

- `key` *Buffer* is the key the particular recipient
- `scheme` *String* is the type of key / the key management scheme for this recipient
- `scheme` *String|Buffer* is the type of key / the key management scheme for this recipient
- `max_attempts` *Integer* (default: 8) how many key_slots you want to assume the envelope has

@@ -42,0 +42,0 @@ - `plain_text` *Buffer* the envelope contents

@@ -0,4 +1,6 @@

/* eslint-disable camelcase */
const test = require('tape')
const vectors = [
require('envelope-spec/vectors/derive_secret1.json'),
require('envelope-spec/vectors/derive_secret1.json')
]

@@ -22,3 +24,3 @@ const labels = require('envelope-spec/derive_secret/constants.json')

const header_key = derive(read_key, [labels.header_key])
const body_key = derive(read_key, [labels.body_key])
const body_key = derive(read_key, [labels.body_key])

@@ -28,2 +30,11 @@ t.deepEqual(read_key, vector.output.read_key, 'derive read_key')

t.deepEqual(body_key, vector.output.body_key, 'derive body_key')
console.log('and with Buffer labels:')
const read_key2 = derive(msg_key, [toBuffer(labels.read_key)])
const header_key2 = derive(read_key, [toBuffer(labels.header_key)])
const body_key2 = derive(read_key, [toBuffer(labels.body_key)])
t.deepEqual(read_key2, vector.output.read_key, 'derive read_key')
t.deepEqual(header_key2, vector.output.header_key, 'derive header_key')
t.deepEqual(body_key2, vector.output.body_key, 'derive body_key')
})

@@ -33,1 +44,5 @@

})
function toBuffer (str) {
return Buffer.from(str, 'utf8')
}

@@ -0,1 +1,2 @@

/* eslint-disable camelcase */
const { Buffer } = require('buffer')

@@ -25,3 +26,3 @@ const na = require('sodium-native')

if (trial_keys.length === 0) return null
const {

@@ -50,7 +51,9 @@ maxAttempts = 8,

msg_key,
ciphertext.slice(32 + j*32, 32 + j*32 + 32) // key_slot
ciphertext.slice(32 + j * 32, 32 + j * 32 + 32) // key_slot
)
// read_key
// └──> header_key
const read_key = derive(msg_key, [LABELS.read_key])
const header_key = derive(read_key, [LABELS.header_key])
const header_key = derive(read_key, [LABELS.header_key])

@@ -57,0 +60,0 @@ if (na.crypto_secretbox_open_easy(header, header_box, zerodNonce, header_key)) {

@@ -0,1 +1,2 @@

/* eslint-disable camelcase */
const hkdf = require('futoin-hkdf')

@@ -2,0 +3,0 @@ const encode = require('./slp-encode')

@@ -0,1 +1,2 @@

/* eslint-disable camelcase */
const error_codes = require('envelope-spec/error_codes.json')

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

/* eslint-disable camelcase */
const xor = require('buffer-xor/inplace')

@@ -13,3 +14,3 @@ const labels = require('envelope-spec/derive_secret/constants.json')

var _flip = null
let _flip = null
function setFlip (recipient) {

@@ -16,0 +17,0 @@ _flip = flip(recipient)

module.exports = function slpEncode (arr) {
var output = Buffer.alloc(0)
let output = Buffer.alloc(0)

@@ -4,0 +4,0 @@ arr.forEach(el => {

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