-
Notifications
You must be signed in to change notification settings - Fork 100
Description
As a front-end developer
I want to use the client API directly from the browser
So that a back-end Node.js server is not required as an intermediary
The key issues are the use of Node packages in the implementation, and some exposure of Node packages in the public API. This includes:
- fs (for FileCheckPointer).
- crypto (for secure random numbers, hashes, private keys and ed25519 signing).
- util (just for convenience).
- crypto.KeyObject (in the signers.newPrivateKeySigner() API).
The core of the implementation either is or can be implemented without using any Node-specific packages. A workable approach seems to be to split this core capability out into a separate package, which can be depended on by the fabric-gateway package. The fabric-gateway package will then only contain Node-specific additions, such as the default signer, hash and checkpointer implementations. @noble/hashes should provide secure random and hash implementations required by the core package (for transactioncontext.ts) without any dependency on Node.js.
The alternatives available with the existing implementation are:
- Use a Node.js back-end server do interact with Fabric on behalf of the browser using the fabric-gateway API, and the off-line signing flow to enable the browser to handle signing using the signing credentials held there.
- Use the Gateway gRPC service directly using the @hyperledger/fabric-protos package.