mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-04-27 11:22:15 +00:00
17 lines
323 B
JavaScript
17 lines
323 B
JavaScript
|
/* global self */
|
||
|
|
||
|
'use strict'
|
||
|
|
||
|
module.exports = () => {
|
||
|
// This is only a shim for interfaces, not for functionality
|
||
|
if (typeof self !== 'undefined') {
|
||
|
require('webcrypto-shim')(self)
|
||
|
|
||
|
if (self.crypto) {
|
||
|
return self.crypto
|
||
|
}
|
||
|
}
|
||
|
|
||
|
throw new Error('Please use an environment with crypto support')
|
||
|
}
|