Merge branch 'file-upload' into collection-ops

This commit is contained in:
Abhinav-grd 2021-01-20 08:43:52 +05:30
commit 1a8d53c739
4 changed files with 9 additions and 7 deletions

View file

@ -31,7 +31,7 @@ export const DropDiv = styled.div`
transition: border 0.24s ease-in-out;
`;
const CollectionDropZone = ({
function CollectionDropZone({
children,
closeModal,
showModal,
@ -40,7 +40,7 @@ const CollectionDropZone = ({
setProgressView,
progressBarProps
}) => {
}) {
const upload = async (acceptedFiles) => {
const token = getToken();

View file

@ -1,7 +1,7 @@
import React from 'react';
import { Button } from 'react-bootstrap';
const UploadButton = ({ showModal }) => {
function UploadButton({ showModal }) {
return (
<Button variant='primary' onClick={showModal}>
Upload New Photos

View file

@ -6,9 +6,11 @@ const CryptoWorker: any = typeof window !== 'undefined'
&& Comlink.wrap(new Worker("worker/crypto.worker.js", { type: 'module' }));
export const getActualKey = async () => {
const cryptoWorker = await new CryptoWorker();
const encryptedKey = getKey(SESSION_KEYS.ENCRYPTION_KEY).encryptionKey;
const session = getData(LS_KEYS.SESSION);
if (session == null)
return;
const cryptoWorker = await new CryptoWorker();
const encryptedKey = getKey(SESSION_KEYS.ENCRYPTION_KEY)?.encryptionKey;
const key: string = await cryptoWorker.decryptB64(encryptedKey, session.sessionNonce, session.sessionKey);
return key;
}

View file

@ -129,10 +129,10 @@ export async function verifyHash(hash: string, input: string) {
return sodium.crypto_pwhash_str_verify(hash, await fromB64(input));
}
export async function hash(input: string | Uint8Array) {
export async function hash(input: string) {
await sodium.ready;
return sodium.crypto_pwhash_str(
input,
await fromB64(input),
sodium.crypto_pwhash_OPSLIMIT_SENSITIVE,
sodium.crypto_pwhash_MEMLIMIT_MODERATE,
);