Draft: refactor: Propose switching FFI library from node-ffi-napi to koffi #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 developedkoffi
.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 thatnode-ffi-napi
is no longer actively maintained. This poses a significant risk for the future ofanoncreds-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.
any
types: The highest priority is to replace the widespread use ofany
with proper, strict type definitions for better code quality and safety.koffi
's internal memory handling instead of the functions previously used inalloc.ts
. This needs to be thoroughly validated to ensure there are no memory leaks or incorrect buffer handling.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.