mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-05-18 05:05:36 +02:00
crypto: eagerly init sodium in dev mode
This commit is contained in:
@@ -19,8 +19,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sodium from "libsodium-wrappers-sumo";
|
||||
|
||||
export function initialize() {
|
||||
return sodium.ready;
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
// this is necessary in development otherwise all the exported functions
|
||||
// are undefined. Since vite supports direct top-level awaits in development
|
||||
// we forcefully ignore typescript.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
await sodium.ready;
|
||||
}
|
||||
|
||||
export async function initialize() {
|
||||
await sodium.ready;
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
@@ -54,10 +54,7 @@ export interface StringMessageTag {
|
||||
tag: number;
|
||||
}
|
||||
|
||||
export function initialize() {
|
||||
console.log("Calling node.js API.");
|
||||
return Promise.resolve();
|
||||
}
|
||||
export async function initialize() {}
|
||||
|
||||
export function crypto_pwhash(
|
||||
keyLength: number,
|
||||
|
||||
Reference in New Issue
Block a user