Browse Source

Merge branch 'rename' of CoBox/cobox-crypto into development

kyphae 2 years ago
parent
commit
7190373065
5 changed files with 194 additions and 73 deletions
  1. 48
    32
      index.js
  2. 0
    12
      lib/keypair.lua
  3. 1
    0
      package.json
  4. 47
    28
      test/index.test.js
  5. 98
    1
      yarn.lock

+ 48
- 32
index.js View File

@@ -1,16 +1,29 @@
1 1
 const sodium = require('sodium-native')
2 2
 const crypto = require('hypercore-crypto')
3 3
 const assert = require('assert')
4
-
5
-module.exports = () => new Crypto()
4
+const bip39 = require('bip39')
6 5
 
7 6
 class Crypto {
7
+  randomBytes (length) {
8
+    return crypto.randomBytes(length)
9
+  }
10
+
8 11
   masterKey () {
9 12
     const key = sodium.sodium_malloc(sodium.crypto_kdf_KEYBYTES)
10 13
     sodium.crypto_kdf_keygen(key)
11 14
     return key
12 15
   }
13 16
 
17
+  address () {
18
+    return this.randomBytes(sodium.crypto_secretbox_KEYBYTES)
19
+  }
20
+
21
+  encryptionKey () {
22
+    var key = sodium.sodium_malloc(sodium.crypto_secretbox_KEYBYTES)
23
+    sodium.randombytes_buf(key)
24
+    return key
25
+  }
26
+
14 27
   keyPair (masterKey, id, ctxt = 'cobox') {
15 28
     const context = sodium.sodium_malloc(sodium.crypto_hash_sha256_BYTES)
16 29
     sodium.crypto_hash_sha256(context, Buffer.from(ctxt))
@@ -20,45 +33,37 @@ class Crypto {
20 33
   }
21 34
 
22 35
   keySet () {
23
-    var publicKey = this.randomBytes(sodium.crypto_secretbox_KEYBYTES)
24
-    var symmetricKey = this.symmetricKey()
25
-    var accessKey = this.pack(publicKey, symmetricKey)
26
-    const encryptionKey = sodium.sodium_malloc(sodium.crypto_secretbox_KEYBYTES)
27
-    sodium.crypto_hash_sha256(encryptionKey, accessKey)
28
-    return { publicKey, symmetricKey, encryptionKey }
29
-  }
30
-
31
-  randomBytes (length) {
32
-    return crypto.randomBytes(length)
33
-  }
34
-
35
-  symmetricKey () {
36
-    var key = sodium.sodium_malloc(sodium.crypto_secretbox_KEYBYTES)
37
-    sodium.randombytes_buf(key)
38
-    return key
36
+    return {
37
+      address: this.address(),
38
+      encryptionKey: this.encryptionKey()
39
+    }
39 40
   }
40 41
 
41 42
   accessKey () {
42
-    return this.pack(this.randomBytes(sodium.crypto_secretbox_KEYBYTES), this.symmetricKey())
43
+    return this.pack(this.randomBytes(sodium.crypto_secretbox_KEYBYTES), this.encryptionKey())
43 44
   }
44 45
 
45
-  pack (pubKey, symKey) {
46
-    pubKey = this.toBuf(pubKey, sodium.crypto_sign_PUBLICKEYBYTES)
47
-    symKey = this.toBuf(symKey, sodium.crypto_secretbox_KEYBYTES)
46
+  pack (address, encryptionKey) {
47
+    address = this.toBuffer(address, sodium.crypto_sign_PUBLICKEYBYTES)
48
+    encryptionKey = this.toBuffer(encryptionKey, sodium.crypto_secretbox_KEYBYTES)
48 49
     const accessKey = sodium.sodium_malloc(sodium.crypto_sign_PUBLICKEYBYTES + sodium.crypto_secretbox_KEYBYTES)
49
-    pubKey.copy(accessKey)
50
-    symKey.copy(accessKey, sodium.crypto_secretbox_KEYBYTES)
50
+    address.copy(accessKey)
51
+    encryptionKey.copy(accessKey, sodium.crypto_secretbox_KEYBYTES)
51 52
     return accessKey
52 53
   }
53 54
 
54 55
   unpack (key) {
55
-    key = this.toBuf(key, [sodium.crypto_sign_PUBLICKEYBYTES, sodium.crypto_sign_PUBLICKEYBYTES + sodium.crypto_secretbox_KEYBYTES])
56
-    if (key.length === sodium.crypto_sign_PUBLICKEYBYTES) return { publicKey: key }
57
-    const publicKey = key.slice(0, sodium.crypto_sign_PUBLICKEYBYTES)
58
-    const symmetricKey = key.slice(sodium.crypto_secretbox_KEYBYTES)
59
-    const encryptionKey = sodium.sodium_malloc(sodium.crypto_secretbox_KEYBYTES)
60
-    sodium.crypto_hash_sha256(encryptionKey, key)
61
-    return { publicKey, symmetricKey, encryptionKey }
56
+    key = this.toBuffer(key, [sodium.crypto_sign_PUBLICKEYBYTES, sodium.crypto_sign_PUBLICKEYBYTES + sodium.crypto_secretbox_KEYBYTES])
57
+
58
+    if (key.length === sodium.crypto_sign_PUBLICKEYBYTES) return { address: key }
59
+
60
+    const address = key.slice(0, sodium.crypto_sign_PUBLICKEYBYTES)
61
+    const encryptionKey = key.slice(sodium.crypto_secretbox_KEYBYTES)
62
+
63
+    return {
64
+      address,
65
+      encryptionKey
66
+    }
62 67
   }
63 68
 
64 69
   isKey (key) {
@@ -68,7 +73,7 @@ class Crypto {
68 73
       length === sodium.crypto_sign_PUBLICKEYBYTES + sodium.crypto_secretbox_KEYBYTES
69 74
   }
70 75
 
71
-  toBuf (stringOrBuffer, lengths) {
76
+  toBuffer (stringOrBuffer, lengths) {
72 77
     if (typeof lengths === 'number') lengths = [lengths]
73 78
     if ((Buffer.isBuffer(stringOrBuffer)) && (lengths.indexOf(stringOrBuffer.length) > -1)) return stringOrBuffer
74 79
     assert(typeof stringOrBuffer === 'string', 'Key is incorrect type')
@@ -77,6 +82,14 @@ class Crypto {
77 82
     return res
78 83
   }
79 84
 
85
+  keyToMnemonic (key) {
86
+    return bip39.entropyToMnemonic(key)
87
+  }
88
+
89
+  mnemonicToKey (mnemonic) {
90
+    return this.toBuffer(bip39.mnemonicToEntropy(mnemonic), [sodium.crypto_secretbox_KEYBYTES])
91
+  }
92
+
80 93
   encoder (encryptionKey, opts = {}) {
81 94
     var can = Buffer.isBuffer(encryptionKey) &&
82 95
       (encryptionKey.length === sodium.crypto_secretbox_KEYBYTES)
@@ -130,3 +143,6 @@ class Crypto {
130 143
     return encoder
131 144
   }
132 145
 }
146
+
147
+module.exports = new Crypto()
148
+

+ 0
- 12
lib/keypair.lua View File

@@ -1,12 +0,0 @@
1
-data = JSON.decode(DATA)
2
-keyring = ECDH.new(data.curve)
3
-keyring:keygen()
4
-assert(ECDH.checkpub(keyring))
5
-
6
-keypair = JSON.encode({
7
-  curve=data.curve,
8
-  public=keyring:public():base64(),
9
-  private=keyring:private():base64()
10
-})
11
-
12
-print(keypair)

+ 1
- 0
package.json View File

@@ -12,6 +12,7 @@
12 12
   },
13 13
   "dependencies": {
14 14
     "assert": "^2.0.0",
15
+    "bip39": "^3.0.2",
15 16
     "hypercore-crypto": "^1.0.0",
16 17
     "sodium-native": "^2.4.2"
17 18
   },

+ 47
- 28
test/index.test.js View File

@@ -3,23 +3,28 @@ const hypercore = require('hypercore')
3 3
 const path = require('path')
4 4
 const fs = require('fs')
5 5
 
6
-const Crypto = require('../')
7
-const crypto = Crypto()
6
+const crypto = require('../')
8 7
 
9 8
 const { cleanup, tmp } = require('./util')
10 9
 
11 10
 describe('key generation', (context) => {
12
-  context('generate an asymmetric keypair', (assert, next) => {
11
+  context('generate a master key', (assert, next) => {
12
+    const masterKey = crypto.masterKey()
13
+    assert.ok(masterKey, 'key generated successfully')
14
+    next()
15
+  })
16
+
17
+  context('generate an derived asymmetric keypair', (assert, next) => {
13 18
     const masterKey = crypto.masterKey()
14 19
     const keypair = crypto.keyPair(masterKey, 0)
15
-    assert.ok(keypair, 'Keys successfully generated')
16
-    assert.ok(keypair.publicKey instanceof Buffer, 'Public Key is a buffer')
17
-    assert.ok(keypair.secretKey instanceof Buffer, 'Secret Key s a buffer')
20
+    assert.ok(keypair, 'keys successfully generated')
21
+    assert.ok(keypair.publicKey instanceof Buffer, 'public key is a buffer')
22
+    assert.ok(keypair.secretKey instanceof Buffer, 'secret key is a buffer')
18 23
     next()
19 24
   })
20 25
 
21
-  context('generate a symmetric key', (assert, next) => {
22
-    const key = crypto.symmetricKey()
26
+  context('generate an shared encryption key', (assert, next) => {
27
+    const key = crypto.encryptionKey()
23 28
     assert.ok(key, 'Key successfully generated')
24 29
     assert.ok(key instanceof Buffer, 'Symmetric key is a buffer')
25 30
     next()
@@ -34,27 +39,27 @@ describe('key generation', (context) => {
34 39
   })
35 40
 
36 41
   context('pack an access key', (assert, next) => {
37
-    const pubKey = crypto.randomBytes(32)
38
-    const secretKey = crypto.symmetricKey()
42
+    const address = crypto.randomBytes(32)
43
+    const encryptionKey = crypto.encryptionKey()
39 44
 
40
-    const accessKey = crypto.pack(pubKey, secretKey)
45
+    const accessKey = crypto.pack(address, encryptionKey)
41 46
     assert.ok(accessKey, 'Key successfully generated')
42 47
     assert.ok(accessKey instanceof Buffer, 'Access key is a buffer')
43 48
     assert.same(accessKey.length, 64, 'read key is 64 bytes')
44
-    assert.same(accessKey.slice(0, 32), pubKey)
45
-    assert.same(accessKey.slice(32, 64), secretKey)
49
+    assert.same(accessKey.slice(0, 32), address)
50
+    assert.same(accessKey.slice(32, 64), encryptionKey)
46 51
     next()
47 52
   })
48 53
 
49 54
   context('pack an access key given as strings', (assert, next) => {
50
-    const pubKey = crypto.randomBytes(32)
51
-    const secretKey = crypto.symmetricKey()
55
+    const address = crypto.randomBytes(32)
56
+    const secretKey = crypto.encryptionKey()
52 57
 
53
-    const accessKey = crypto.pack(pubKey.toString('hex'), secretKey.toString('hex'))
58
+    const accessKey = crypto.pack(address.toString('hex'), secretKey.toString('hex'))
54 59
     assert.ok(accessKey, 'Key successfully generated')
55 60
     assert.ok(accessKey instanceof Buffer, 'Access key is a buffer')
56 61
     assert.same(accessKey.length, 64, 'read key is 64 bytes')
57
-    assert.same(accessKey.slice(0, 32), pubKey)
62
+    assert.same(accessKey.slice(0, 32), address)
58 63
     assert.same(accessKey.slice(32, 64), secretKey)
59 64
     next()
60 65
   })
@@ -63,11 +68,11 @@ describe('key generation', (context) => {
63 68
     const accessKey = crypto.accessKey()
64 69
 
65 70
     const keys = crypto.unpack(accessKey)
66
-    const pubKey = accessKey.slice(0, 32)
67
-    const symKey = accessKey.slice(32, 64)
71
+    const address = accessKey.slice(0, 32)
72
+    const encryptionKey = accessKey.slice(32, 64)
68 73
 
69
-    assert.same(keys.publicKey, pubKey, 'Unpacks the public key')
70
-    assert.same(keys.symmetricKey, symKey, 'Unpacks the symmetric key')
74
+    assert.same(keys.address, address, 'Unpacks the public key')
75
+    assert.same(keys.encryptionKey, encryptionKey, 'Unpacks the symmetric key')
71 76
     next()
72 77
   })
73 78
 
@@ -75,9 +80,11 @@ describe('key generation', (context) => {
75 80
     const accessKey = crypto.accessKey()
76 81
     assert.ok(crypto.isKey(accessKey), '64 byte buffer is a valid read/write key')
77 82
     assert.ok(crypto.isKey(accessKey.toString('hex')), '64 byte string is a valid read/write key')
83
+
78 84
     const blindKey = crypto.randomBytes(32)
79 85
     assert.ok(crypto.isKey(blindKey), '32 byte public key is a valid blind replication key')
80 86
     assert.ok(crypto.isKey(blindKey.toString('hex')), '32 byte string is a valid blind replication key')
87
+
81 88
     next()
82 89
   })
83 90
 
@@ -85,18 +92,30 @@ describe('key generation', (context) => {
85 92
     const accessKey = crypto.accessKey()
86 93
 
87 94
     const keys = crypto.unpack(accessKey.toString('hex'))
88
-    const pubKey = accessKey.slice(0, 32)
89
-    const symKey = accessKey.slice(32, 64)
95
+    const address = accessKey.slice(0, 32)
96
+    const encryptionKey = accessKey.slice(32, 64)
97
+
98
+    assert.same(keys.address, address, 'Unpacks the public key')
99
+    assert.same(keys.encryptionKey, encryptionKey, 'Unpacks the symmetric key')
100
+    next()
101
+  })
102
+
103
+  context('mnemnonic', (assert, next) => {
104
+    const encryptionKey = crypto.encryptionKey()
105
+    const words = crypto.keyToMnemonic(encryptionKey)
106
+    assert.ok(words, 'generates a mnemonic')
107
+    assert.ok(words.split(/\s/).length, 24, '24 words long')
108
+
109
+    var check = crypto.mnemonicToKey(words)
110
+    assert.same(encryptionKey, check, 'returns the correct key')
90 111
 
91
-    assert.same(keys.publicKey, pubKey, 'Unpacks the public key')
92
-    assert.same(keys.symmetricKey, symKey, 'Unpacks the symmetric key')
93 112
     next()
94 113
   })
95 114
 })
96 115
 
97 116
 describe('message encoding', (context) => {
98 117
   context('encrypt and decrypt a message', (assert, next) => {
99
-    const key = crypto.symmetricKey()
118
+    const key = crypto.encryptionKey()
100 119
     const encoder = crypto.encoder(key, { valueEncoding: 'utf-8' })
101 120
 
102 121
     const encrypted = encoder.encode("Hello World")
@@ -117,7 +136,7 @@ describe('hypercore', (context) => {
117 136
   })
118 137
 
119 138
   context('encrypted the log', (assert, next) => {
120
-    const key = crypto.symmetricKey()
139
+    const key = crypto.encryptionKey()
121 140
     const encoder = crypto.encoder(key, { valueEncoding: 'utf-8' })
122 141
     const feed = hypercore(storage, { valueEncoding: encoder })
123 142
 
@@ -138,7 +157,7 @@ describe('hypercore', (context) => {
138 157
   })
139 158
 
140 159
   context('encrypted the log, with a json object', (assert, next) => {
141
-    const key = crypto.symmetricKey()
160
+    const key = crypto.encryptionKey()
142 161
     const encoder = crypto.encoder(key, { valueEncoding: 'json' })
143 162
     const feed = hypercore(storage, { valueEncoding: encoder })
144 163
 

+ 98
- 1
yarn.lock View File

@@ -90,6 +90,11 @@
90 90
     lodash "^4.17.13"
91 91
     to-fast-properties "^2.0.0"
92 92
 
93
+"@types/node@11.11.6":
94
+  version "11.11.6"
95
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a"
96
+  integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==
97
+
93 98
 ansi-regex@^2.0.0:
94 99
   version "2.1.1"
95 100
   resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@@ -156,6 +161,16 @@ balanced-match@^1.0.0:
156 161
   resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
157 162
   integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
158 163
 
164
+bip39@^3.0.2:
165
+  version "3.0.2"
166
+  resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.2.tgz#2baf42ff3071fc9ddd5103de92e8f80d9257ee32"
167
+  integrity sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==
168
+  dependencies:
169
+    "@types/node" "11.11.6"
170
+    create-hash "^1.1.0"
171
+    pbkdf2 "^3.0.9"
172
+    randombytes "^2.0.1"
173
+
159 174
 bitfield-rle@^2.2.1:
160 175
   version "2.2.1"
161 176
   resolved "https://registry.yarnpkg.com/bitfield-rle/-/bitfield-rle-2.2.1.tgz#07c910f7e650c005c46d18ee5ca6e62c4baf8310"
@@ -259,6 +274,14 @@ chalk@^2.0.0:
259 274
     escape-string-regexp "^1.0.5"
260 275
     supports-color "^5.3.0"
261 276
 
277
+cipher-base@^1.0.1, cipher-base@^1.0.3:
278
+  version "1.0.4"
279
+  resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
280
+  integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==
281
+  dependencies:
282
+    inherits "^2.0.1"
283
+    safe-buffer "^5.0.1"
284
+
262 285
 cliui@^5.0.0:
263 286
   version "5.0.0"
264 287
   resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"
@@ -328,6 +351,29 @@ cp-file@^6.2.0:
328 351
     pify "^4.0.1"
329 352
     safe-buffer "^5.0.1"
330 353
 
354
+create-hash@^1.1.0, create-hash@^1.1.2:
355
+  version "1.2.0"
356
+  resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196"
357
+  integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==
358
+  dependencies:
359
+    cipher-base "^1.0.1"
360
+    inherits "^2.0.1"
361
+    md5.js "^1.3.4"
362
+    ripemd160 "^2.0.1"
363
+    sha.js "^2.4.0"
364
+
365
+create-hmac@^1.1.4:
366
+  version "1.1.7"
367
+  resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff"
368
+  integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==
369
+  dependencies:
370
+    cipher-base "^1.0.3"
371
+    create-hash "^1.1.0"
372
+    inherits "^2.0.1"
373
+    ripemd160 "^2.0.0"
374
+    safe-buffer "^5.0.1"
375
+    sha.js "^2.4.8"
376
+
331 377
 cross-spawn@^4:
332 378
   version "4.0.2"
333 379
   resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
@@ -574,6 +620,14 @@ has@^1.0.1, has@^1.0.3, has@~1.0.3:
574 620
   dependencies:
575 621
     function-bind "^1.1.1"
576 622
 
623
+hash-base@^3.0.0:
624
+  version "3.0.4"
625
+  resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918"
626
+  integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=
627
+  dependencies:
628
+    inherits "^2.0.1"
629
+    safe-buffer "^5.0.1"
630
+
577 631
 hasha@^3.0.0:
578 632
   version "3.0.0"
579 633
   resolved "https://registry.yarnpkg.com/hasha/-/hasha-3.0.0.tgz#52a32fab8569d41ca69a61ff1a214f8eb7c8bd39"
@@ -871,6 +925,15 @@ make-dir@^2.0.0, make-dir@^2.1.0:
871 925
     pify "^4.0.1"
872 926
     semver "^5.6.0"
873 927
 
928
+md5.js@^1.3.4:
929
+  version "1.3.5"
930
+  resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"
931
+  integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==
932
+  dependencies:
933
+    hash-base "^3.0.0"
934
+    inherits "^2.0.1"
935
+    safe-buffer "^5.1.2"
936
+
874 937
 memory-pager@^1.0.2:
875 938
   version "1.5.0"
876 939
   resolved "https://registry.yarnpkg.com/memory-pager/-/memory-pager-1.5.0.tgz#d8751655d22d384682741c972f2c3d6dfa3e66b5"
@@ -1120,6 +1183,17 @@ path-type@^3.0.0:
1120 1183
   dependencies:
1121 1184
     pify "^3.0.0"
1122 1185
 
1186
+pbkdf2@^3.0.9:
1187
+  version "3.0.17"
1188
+  resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6"
1189
+  integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==
1190
+  dependencies:
1191
+    create-hash "^1.1.2"
1192
+    create-hmac "^1.1.4"
1193
+    ripemd160 "^2.0.1"
1194
+    safe-buffer "^5.0.1"
1195
+    sha.js "^2.4.8"
1196
+
1123 1197
 pify@^3.0.0:
1124 1198
   version "3.0.0"
1125 1199
   resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"
@@ -1208,6 +1282,13 @@ random-access-storage@^1.1.1:
1208 1282
   dependencies:
1209 1283
     inherits "^2.0.3"
1210 1284
 
1285
+randombytes@^2.0.1:
1286
+  version "2.1.0"
1287
+  resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
1288
+  integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
1289
+  dependencies:
1290
+    safe-buffer "^5.1.0"
1291
+
1211 1292
 re-emitter@1.1.3:
1212 1293
   version "1.1.3"
1213 1294
   resolved "https://registry.yarnpkg.com/re-emitter/-/re-emitter-1.1.3.tgz#fa9e319ffdeeeb35b27296ef0f3d374dac2f52a7"
@@ -1318,7 +1399,15 @@ rimraf@^2.6.3:
1318 1399
   dependencies:
1319 1400
     glob "^7.1.3"
1320 1401
 
1321
-safe-buffer@^5.0.1, safe-buffer@^5.1.2:
1402
+ripemd160@^2.0.0, ripemd160@^2.0.1:
1403
+  version "2.0.2"
1404
+  resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c"
1405
+  integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==
1406
+  dependencies:
1407
+    hash-base "^3.0.0"
1408
+    inherits "^2.0.1"
1409
+
1410
+safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2:
1322 1411
   version "5.2.0"
1323 1412
   resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
1324 1413
   integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
@@ -1343,6 +1432,14 @@ set-blocking@^2.0.0:
1343 1432
   resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
1344 1433
   integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
1345 1434
 
1435
+sha.js@^2.4.0, sha.js@^2.4.8:
1436
+  version "2.4.11"
1437
+  resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7"
1438
+  integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==
1439
+  dependencies:
1440
+    inherits "^2.0.1"
1441
+    safe-buffer "^5.0.1"
1442
+
1346 1443
 signal-exit@^3.0.0, signal-exit@^3.0.2:
1347 1444
   version "3.0.2"
1348 1445
   resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"