Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

fix support for WebWorkers #11

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions src/crypto-browser.js

This file was deleted.

15 changes: 8 additions & 7 deletions src/crypto-sha1-2-browser.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/* global self */

'use strict'

const nodeify = require('nodeify')

const webCrypto = getWebCrypto()

function getWebCrypto () {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file (crypto-sha1-2-browser.js) adds a new method sha3 that is not present in crypto-browser.js, other than that they are exactly the same, should we remove crypto-browser.js?

if (typeof window !== 'undefined') {
if (window.crypto) {
return window.crypto.subtle || window.crypto.webkitSubtle
}
const globalCtx = typeof window !== 'undefined' ? window : self
if (globalCtx.crypto) {
return globalCtx.crypto.subtle || globalCtx.crypto.webkitSubtle
}

if (window.msCrypto) {
return window.msCrypto.subtle
}
if (globalCtx.msCrypto) {
return globalCtx.msCrypto.subtle
}
}

Expand Down