Commit 806b9f80cab0da81d7e98a62754b80167fe58296
replace node-webcrypto-shim with crypto
Norton Wang committed on 3/9/2018, 6:17:37 PMParent: e2cd325fdcc6c86a830407f0c4c8638f3a5ad25a
Files changed
datastore.js | changed |
package-lock.json | changed |
package.json | changed |
datastore.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 | const Buffer = require('safe-buffer').Buffer |
2 | -const crypto = require('node-webcrypto-shim') | |
2 | +const crypto = require('crypto') | |
3 | 3 | const DAG = require('ipld-graph-builder/datastore.js') |
4 | 4 | const HASH_LEN = 20 |
5 | 5 | const cbor = require('borc') |
6 | 6 | |
@@ -34,9 +34,9 @@ | ||
34 | 34 | return Buffer.isBuffer(link) && link.length === HASH_LEN |
35 | 35 | } |
36 | 36 | |
37 | 37 | 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) | |
41 | 41 | } |
42 | 42 | } |
package-lock.json | ||
---|---|---|
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 |
Built with git-ssb-web