Skip to content

Conversation

huketo
Copy link

@huketo huketo commented Sep 16, 2025

This Pull Request proposes a switch of the underlying FFI (Foreign Function Interface) library from the unmaintained node-ffi-napi to the modern and actively developed koffi.

Motivation

I encountered a critical build failure with node-ffi-napi on Windows with Node.js v16 and above, which completely blocked development. Upon investigation, it appears that node-ffi-napi is no longer actively maintained. This poses a significant risk for the future of anoncreds-wrapper-javascript, as it's likely that similar dependency issues will eventually arise on other operating systems.

My immediate need was to develop a Holder Agent on a Windows environment. To move forward, I replaced the FFI library with [koffi](https://koffi.dev). After the switch, I can confirm that all tests for anoncreds-wrapper-javascript pass successfully on my Windows machine, and I am now proceeding with my agent's development.

For the long-term health and cross-platform stability of this library, I am formally proposing this transition to koffi.

🚧 Known Issues & TODO List

As this was implemented quickly to meet an urgent development schedule, there are several areas that require review and improvement before this can be considered for merging. This draft is intended to start the conversation.

  • Remove any types: The highest priority is to replace the widespread use of any with proper, strict type definitions for better code quality and safety.
  • Verify memory management: The new implementation relies on koffi's internal memory handling instead of the functions previously used in alloc.ts. This needs to be thoroughly validated to ensure there are no memory leaks or incorrect buffer handling.
  • Performance review: Investigate if the latest features in koffi can be leveraged for performance optimizations.

I welcome any feedback and am open to discussing further improvements. Your input would be invaluable in making this transition robust and ready.

- Switched to koffi due to node-ffi-napi's incompatibility with Node.js v16+ on Windows.

Signed-off-by: huketo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant