mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-05-22 15:31:37 +00:00
Support for WebWorker.
Signed-off-by: Tom Swindell <t.swindell@rubyx.co.uk>
This commit is contained in:
parent
c45bdf602e
commit
98bc0bbc5f
@ -10,5 +10,13 @@ module.exports = function getWebCrypto () {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof self !== 'undefined') {
|
||||
require('webcrypto-shim')(self)
|
||||
|
||||
if (self.crypto) {
|
||||
return self.crypto
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('Please use an environment with crypto support')
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user