From 6fc05a41fd00c3dd69ab90c70b090e35078e1f80 Mon Sep 17 00:00:00 2001 From: Brian Ginsburg Date: Wed, 8 Sep 2021 16:00:28 -0700 Subject: [PATCH] Fix tweetnacl imports --- src/crypto/browser.ts | 4 ++-- src/setup/node.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/browser.ts b/src/crypto/browser.ts index 53c745426..c635ed264 100644 --- a/src/crypto/browser.ts +++ b/src/crypto/browser.ts @@ -1,4 +1,4 @@ -import { sign } from "tweetnacl" +import tweetnacl from "tweetnacl" import rsaOperations from "keystore-idb/rsa/index.js" import utils from "keystore-idb/utils.js" import aes from "keystore-idb/aes/index.js" @@ -65,7 +65,7 @@ export const rsaVerify = (message: Uint8Array, signature: Uint8Array, publicKey: } export const ed25519Verify = (message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): Promise => { - return new Promise(resolve => resolve(sign.detached.verify(signature, message, publicKey))) + return new Promise(resolve => resolve(tweetnacl.sign.detached.verify(signature, message, publicKey))) } export const ksPublicReadKey = async (): Promise => { diff --git a/src/setup/node.ts b/src/setup/node.ts index 99d744673..39a98ebea 100644 --- a/src/setup/node.ts +++ b/src/setup/node.ts @@ -1,5 +1,5 @@ import crypto from "crypto" -import { sign } from "tweetnacl" +import tweetnacl from "tweetnacl" import utils from "keystore-idb/utils.js" import { CharSize, Config, CryptoSystem, KeyStore, KeyUse, Msg, PublicKey, SymmKeyLength } from "keystore-idb/types.js" import config from "keystore-idb/config.js" @@ -75,7 +75,7 @@ const rsaVerify = (message: Uint8Array, signature: Uint8Array, publicKey: Uint8A } const ed25519Verify = (message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): Promise => { - return new Promise(resolve => resolve(sign.detached.verify(signature, message, publicKey))) + return new Promise(resolve => resolve(tweetnacl.sign.detached.verify(signature, message, publicKey))) }