aboutsummaryrefslogtreecommitdiffstats
path: root/library/sodium-plus/build/pre-build.patch
blob: d6304bf65c54e3ba3b3e10b807073a604b7e5668 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
diff --git a/lib/backend/sodiumnative.js b/lib/backend/sodiumnative.js
index a592b10..f268085 100644
--- a/lib/backend/sodiumnative.js
+++ b/lib/backend/sodiumnative.js
@@ -1,12 +1,5 @@
 let loaded = false;
-let _sodium;
-/* istanbul ignore next */
-try {
-    _sodium = require('sodium-native');
-    loaded = true;
-} catch (e) {
-    _sodium = {};
-}
+let _sodium = {};
 const Backend = require('../backend');
 const CryptographyKey = require('../cryptography-key');
 const SodiumError = require('../sodium-error');
diff --git a/lib/sodiumplus.js b/lib/sodiumplus.js
index a592b10..f268085 100644
--- a/lib/sodiumplus.js
+++ b/lib/sodiumplus.js
@@ -4,7 +4,6 @@
 const Ed25519PublicKey = require('./keytypes/ed25519pk');
 const LibsodiumWrappersBackend = require('./backend/libsodium-wrappers');
 const SodiumError = require('./sodium-error');
-const SodiumNativeBackend = require('./backend/sodiumnative');
 const X25519PublicKey = require('./keytypes/x25519pk');
 const X25519SecretKey = require('./keytypes/x25519sk');
 const Util = require('./util');
@@ -41,7 +40,7 @@
      * @return {boolean}
      */
     isSodiumNative() {
-        return (this.backend instanceof SodiumNativeBackend);
+        return false;
     }
 
     /**
@@ -60,16 +59,7 @@
      * @return {Promise<SodiumPlus>}
      */
     static async auto() {
-        let backend;
-        try {
-            backend = await SodiumNativeBackend.init();
-        } catch (e) {
-            backend = await LibsodiumWrappersBackend.init();
-        }
-        /* istanbul ignore if */
-        if (!backend) {
-            backend = await LibsodiumWrappersBackend.init();
-        }
+        let backend = await LibsodiumWrappersBackend.init();
         Util.populateConstants(backend);
         return new SodiumPlus(backend);
     }