git ssb

0+

wanderer🌟 / js-dfinity-radix-tree



Commit 806b9f80cab0da81d7e98a62754b80167fe58296

replace node-webcrypto-shim with crypto

Norton Wang committed on 3/9/2018, 6:17:37 PM
Parent: e2cd325fdcc6c86a830407f0c4c8638f3a5ad25a

Files changed

datastore.jschanged
package-lock.jsonchanged
package.jsonchanged
datastore.jsView
@@ -1,6 +1,6 @@
11 const Buffer = require('safe-buffer').Buffer
2-const crypto = require('node-webcrypto-shim')
2+const crypto = require('crypto')
33 const DAG = require('ipld-graph-builder/datastore.js')
44 const HASH_LEN = 20
55 const cbor = require('borc')
66
@@ -34,9 +34,9 @@
3434 return Buffer.isBuffer(link) && link.length === HASH_LEN
3535 }
3636
3737 static getMerkleLink (buf) {
38- return crypto.subtle.digest({
39- name: 'SHA-256'
40- }, buf).then(link => Buffer.from(link.slice(0, HASH_LEN)))
38+ const hash = crypto.createHash('sha256')
39+ hash.update(buf)
40+ return hash.digest().slice(0, HASH_LEN)
4141 }
4242 }
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 327883 bytes
New file size: 326613 bytes
package.jsonView
@@ -28,9 +28,8 @@
2828 },
2929 "dependencies": {
3030 "borc": "^2.0.2",
3131 "ipld-graph-builder": "^1.3.7",
32- "node-webcrypto-shim": "0.0.0",
3332 "text-encoding": "^0.6.4",
3433 "uint1array": "^1.0.5"
3534 },
3635 "standard": {

Built with git-ssb-web