import { reactive } from 'vue';
import * as pc from './lib/purecrypto.js';
export const state = reactive({
status: 'idle', error: null,
});
export function initCrypto() {
if (state.status === 'ready' || state.status === 'loading') return;
state.status = 'loading';
const url = `${import.meta.env.BASE_URL}purecrypto.wasm`;
pc.load(url)
.then(() => {
state.status = 'ready';
})
.catch((e) => {
state.status = 'error';
state.error = String(e);
});
}
export { pc };