try to make wasm work
All checks were successful
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Has been skipped
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Successful in 9m4s
Podman Rootless Demo / deploy-prod (push) Successful in 55s

This commit is contained in:
continuist 2025-10-26 11:03:00 -04:00
parent ec8d90cb15
commit bb70355151

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 = {