Support Safari (not tested)
This commit is contained in:
parent
77d753d84c
commit
6e4cb56a27
|
@ -7,16 +7,20 @@
|
|||
*
|
||||
* @module bitmessage/crypto.browser
|
||||
*/
|
||||
// FIXME(Kagami): Support webkit subtle prefix!
|
||||
// TODO(Kagami): Try to support IE11.
|
||||
|
||||
"use strict";
|
||||
|
||||
require("es6-promise").polyfill();
|
||||
var ripemd160 = require("ripemd160");
|
||||
var assert = require("./utils").assert;
|
||||
|
||||
// Support `webkit` prefix for Safari (not tested yet).
|
||||
// TODO(Kagami): Try to support IE11.
|
||||
var subtle = window.crypto.subtle || window.crypto.webkitSubtle;
|
||||
assert(subtle, "WebCryptoAPI is not supported");
|
||||
|
||||
exports.sha512 = function(buf) {
|
||||
return window.crypto.subtle.digest({name: "SHA-512"}, buf).then(function(arr) {
|
||||
return subtle.digest({name: "SHA-512"}, buf).then(function(arr) {
|
||||
return new Buffer(new Uint8Array(arr));
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user