feature/1-self-sovereign-passports-for-user-identity #2

Merged
continuist merged 29 commits from feature/1-self-sovereign-passports-for-user-identity into main 2025-11-01 10:32:30 -04:00
Showing only changes of commit bb70355151 - Show all commits

View file

@ -1,7 +1,6 @@
import type { UserProfile, SPFPassport } from './auth/types';
'use client';
// Import the generated WASM module types
// import type * as WasmModule from '../wasm/pkg/sharenet_passport_wasm';
import type { UserProfile, SPFPassport } from './auth/types';
/**
* WASM module interface with proper TypeScript typing
@ -54,12 +53,17 @@ export class PassportWASMLoader {
}
try {
// Dynamically import the WASM bindings - they handle the WASM initialization
// Dynamically import the WASM bindings
// With bundler target, the module is automatically initialized on import
// but we need to ensure the WASM memory is ready before calling functions
const wasmModule = await import('./wasm-pkg/sharenet_passport_wasm');
// Initialize the WASM module using the default export
// With bundler target, this automatically handles the WASM loading
await wasmModule.default();
// Test that the WASM module is properly initialized by checking if
// the wasm memory is accessible through a simple property access
// This ensures the WASM module is fully loaded before we use it
if (!wasmModule || typeof wasmModule.parse_spf_file !== 'function') {
throw new Error('WASM module exports not properly loaded');
}
// Create wrapper functions with proper typing
const wasmWrapper: PassportWASM = {