Fixed builds again
This commit is contained in:
parent
f018dafa4f
commit
077d1ae864
2 changed files with 26 additions and 7 deletions
|
|
@ -76,11 +76,11 @@ export default function Provider(props: { children: React.ReactNode }) {
|
|||
|
||||
/**
|
||||
* Creates crypto action functions that safely delegate to the worker API.
|
||||
* @param apiRef Worker API reference object.
|
||||
* @param getApiRef Function that returns the worker API reference.
|
||||
* @returns Typed crypto action functions.
|
||||
*/
|
||||
export function createCryptoActions(
|
||||
apiRef: React.RefObject<ApiRef | null>,
|
||||
getApiRef: () => ApiRef | null,
|
||||
): CryptoContextType {
|
||||
/**
|
||||
* Encrypts plaintext by delegating to the crypto worker API.
|
||||
|
|
@ -92,7 +92,7 @@ export function createCryptoActions(
|
|||
secret: string,
|
||||
plaintext: string,
|
||||
): Promise<string> => {
|
||||
const api = apiRef.current;
|
||||
const api = getApiRef();
|
||||
if (!api) throw new Error("API not initialized");
|
||||
return await api.encrypt(secret, plaintext);
|
||||
};
|
||||
|
|
@ -107,7 +107,7 @@ export function createCryptoActions(
|
|||
secret: string,
|
||||
ciphertext: string,
|
||||
): Promise<string> => {
|
||||
const api = apiRef.current;
|
||||
const api = getApiRef();
|
||||
if (!api) throw new Error("API not initialized");
|
||||
return await api.decrypt(secret, ciphertext);
|
||||
};
|
||||
|
|
@ -124,7 +124,7 @@ export function createCryptoActions(
|
|||
ownPublicKey: string,
|
||||
otherPublicKey: string,
|
||||
): Promise<string> => {
|
||||
const api = apiRef.current;
|
||||
const api = getApiRef();
|
||||
if (!api) throw new Error("API not initialized");
|
||||
return await api.getSharedSecret(
|
||||
ownPrivateKey,
|
||||
|
|
|
|||
Loading…
Reference in a new issue