feat: add securosys signing driver - #2123
Conversation
28d29fe to
11e11b9
Compare
mjuchli-da
left a comment
There was a problem hiding this comment.
Thank you for the contribution! The PR looks very solid, and the most fundamental parts were provided:
- Driver
- Allocator extension
- TransactionService extension
- Tests
There are a few CI blockers and a couple of robustness items before merge. In addition, my manual testing has resulted in an error when attempting to sign a transaction.
Blockers
- CI
test-static: Prettier failures undercore/signing-securosys/test-unit: branch coverage 75.38% < 80% threshold for@canton-network/core-signing-securosys
- Rebase / build tooling — package uses
tsup+tsup.base;mainhas moved totsdown. Please rebase and align with othercore/signing-*packages. EXECUTEDwithout signature —mapTsbStatusmapsEXECUTED→signed, but signature is only populated whenresponse.resultis present. Returning signed-without-signature hard-fails in the gateway. Fall back topending(or error) until a usable signature exists.
Manual user testing
I've tested the signing driver with the sent credentials.
Allocate a party/wallet ✅
This worked perfectly by using the asynchronous workflow:
createKeygetTransaction- allocate with received signature
Sign a transaction ❌
The creation of a Ping contract failed at the signing step:
"Error from signing driver: TSB API call to /v1/key/attributes failed (500): {\"errorCode\":701,\"reason\":\"res.error.in.hsm\",\"message\":\"HSM error: status: PKCS#11: KEY_FUNCTION_NOT_PERMITTED\"}",
Signed-off-by: mikolaj <mikolaj.szargut@securosys.ch>
11e11b9 to
3162936
Compare
1. CI: - test coverage > 80% - prettier failures under core/signing-securosys/ 2. Rebase - done 3. Test workflow with "EXECUTED without signature" fixed Signed-off-by: mikolaj <mikolaj.szargut@securosys.ch>
Signed-off-by: mikolaj <mikolaj.szargut@securosys.ch>
Signed-off-by: mikolaj <mikolaj.szargut@securosys.ch>
|
I fixed errors on pipeline related with securosys signing driver - prettier env.ts file and add node to tsdown config. Other errors looks like there is some issues with playwright. |
Signed-off-by: mikolaj <mikolaj.szargut@securosys.ch>
mjuchli-da
left a comment
There was a problem hiding this comment.
Congrats!, I verified that the current state works.
I'll leave it to @pawelstepien-da to point out to a few minor ones.
pawelstepien-da
left a comment
There was a problem hiding this comment.
Looks very good. Leaving 3 minor comments.
Fix for playwright errors you saw in CI is already merged to main.
|
|
||
| public async createKey(params: CreateKeyParams): Promise<Key> { | ||
| const request = compact({ | ||
| label: params.name, |
There was a problem hiding this comment.
Party hint is used as label here. Key label has to be unique, while party hint is not.
For example on a single Wallet Gateway instance 2 different users connected to 2 different networks could try to create a party with same hint, and the one who does it later gets error from Securesys API:
{\"errorCode\":608,\"reason\":\"res.error.key.already.existing\",\"message\":\"Could not create key. The key name is already in use.\"}"
I see 2 possible approaches:
-Make key labels something unique. This would probably be problematic when using signTransaction with keyIdentifier.id and warrant using only keyIdentifier.publicKey and I see from the code that acquiring key label by publicKey from API is not straightforward.
-Accept it as driver's limitation and document it in README.md. I confirmed with @mjuchli-da that this is also fine.
Signed-off-by: mikolaj <mikolaj.szargut@securosys.ch>
@canton-network/core-signing-securosys
Signing driver for integrating the Canton Wallet Gateway with Securosys TSB.
Features
createKeycreates a TSB SKA key with a hardcoded empty policy.getKeysenumerates TSB keys and returns Wallet Gateway-compatible publickeys.
signTransactioncreates a TSB sign request and returns the TSB request ID asthe provider
txId.getTransactionmaps TSB request status/result into Wallet Gatewaytransaction status/signature fields.
getTransactionsfetches by provider transaction IDs. Public-key-onlyfiltering is supported from this driver's in-memory transaction cache.
getConfiguration/setConfiguration.