mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
add: restore old crypto package, isomorphic changes things in react-native
This commit is contained in:
parent
40b47a2621
commit
72c699f20b
955
package-lock.json
generated
955
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -59,11 +59,11 @@
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"text-encoding": "^0.7.0",
|
||||
"emailjs": "^2.2.0"
|
||||
"emailjs": "^2.2.0",
|
||||
"@peculiar/webcrypto": "^1.0.22",
|
||||
"buffer": "^5.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"isomorphic-webcrypto": "^2.*",
|
||||
"buffer": "^5.*",
|
||||
"@gooddollar/react-native-webview-crypto": "^0.*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
12
sea.js
12
sea.js
@ -182,15 +182,19 @@
|
||||
api.TextDecoder = TextDecoder;
|
||||
api.TextEncoder = TextEncoder;
|
||||
}
|
||||
if(!api.crypto){try{
|
||||
if(!api.crypto)
|
||||
{
|
||||
try
|
||||
{
|
||||
var crypto = USE('crypto', 1);
|
||||
Object.assign(api, {
|
||||
crypto,
|
||||
random: (len) => Buffer.from(crypto.randomBytes(len))
|
||||
});
|
||||
const isocrypto = require('isomorphic-webcrypto');
|
||||
api.ossl = api.subtle = isocrypto.subtle;
|
||||
}catch(e){
|
||||
const { Crypto: WebCrypto } = USE('@peculiar/webcrypto', 1);
|
||||
api.ossl = api.subtle = new WebCrypto({directory: 'ossl'}).subtle // ECDH
|
||||
}
|
||||
catch(e){
|
||||
console.log("text-encoding and isomorphic-webcrypto may not be included by default, please add it to your package.json!");
|
||||
TEXT_ENCODING_OR_PECULIAR_WEBCRYPTO_NOT_INSTALLED;
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user