Merge branch 'file-upload' into collection-ops
This commit is contained in:
commit
1a8d53c739
4 changed files with 9 additions and 7 deletions
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue