@canton-network/core-signing-participant 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controller.d.ts +17 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/controller.js +36 -0
- package/dist/controller.test.d.ts +2 -0
- package/dist/controller.test.d.ts.map +1 -0
- package/dist/controller.test.js +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PartyMode, SigningDriverInterface, SigningProvider } from '@canton-network/core-signing-lib';
|
|
2
|
+
import { AuthContext } from '@canton-network/core-wallet-auth';
|
|
3
|
+
export declare class ParticipantSigningDriver implements SigningDriverInterface {
|
|
4
|
+
partyMode: PartyMode;
|
|
5
|
+
signingProvider: SigningProvider;
|
|
6
|
+
controller: (_userId: AuthContext["userId"] | undefined) => {
|
|
7
|
+
signTransaction: import("@canton-network/core-signing-lib").SignTransaction;
|
|
8
|
+
getTransaction: import("@canton-network/core-signing-lib").GetTransaction;
|
|
9
|
+
getTransactions: import("@canton-network/core-signing-lib").GetTransactions;
|
|
10
|
+
getKeys: import("@canton-network/core-signing-lib").GetKeys;
|
|
11
|
+
createKey: import("@canton-network/core-signing-lib").CreateKey;
|
|
12
|
+
getConfiguration: import("@canton-network/core-signing-lib").GetConfiguration;
|
|
13
|
+
setConfiguration: import("@canton-network/core-signing-lib").SetConfiguration;
|
|
14
|
+
subscribeTransactions: import("@canton-network/core-signing-lib").SubscribeTransactions;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,SAAS,EAET,sBAAsB,EACtB,eAAe,EAIlB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAG9D,qBAAa,wBAAyB,YAAW,sBAAsB;IAC5D,SAAS,YAAqB;IAC9B,eAAe,kBAA8B;IAE7C,UAAU,GACb,SAAS,WAAW,CAAC,QAAQ,CAAC,GAAG,SAAS;;;;;;;;;MAiCxC;CACT"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { buildController, PartyMode, SigningProvider, } from '@canton-network/core-signing-lib';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
export class ParticipantSigningDriver {
|
|
4
|
+
partyMode = PartyMode.INTERNAL;
|
|
5
|
+
signingProvider = SigningProvider.PARTICIPANT;
|
|
6
|
+
controller = (_userId // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
|
+
) => buildController({
|
|
8
|
+
signTransaction: async (params) => {
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
txId: params.internalTxId || randomUUID(),
|
|
11
|
+
status: 'signed',
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
getTransaction: function () {
|
|
15
|
+
throw new Error('Function not implemented.');
|
|
16
|
+
},
|
|
17
|
+
getTransactions: function () {
|
|
18
|
+
throw new Error('Function not implemented.');
|
|
19
|
+
},
|
|
20
|
+
getKeys: function () {
|
|
21
|
+
throw new Error('Function not implemented.');
|
|
22
|
+
},
|
|
23
|
+
createKey: function () {
|
|
24
|
+
throw new Error('Function not implemented.');
|
|
25
|
+
},
|
|
26
|
+
getConfiguration: function () {
|
|
27
|
+
throw new Error('Function not implemented.');
|
|
28
|
+
},
|
|
29
|
+
setConfiguration: function () {
|
|
30
|
+
throw new Error('Function not implemented.');
|
|
31
|
+
},
|
|
32
|
+
subscribeTransactions: function () {
|
|
33
|
+
throw new Error('Function not implemented.');
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../src/controller.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { expect, test } from '@jest/globals';
|
|
2
|
+
import { ParticipantSigningDriver } from './controller.js';
|
|
3
|
+
const TEST_TRANSACTION = 'test-tx';
|
|
4
|
+
const TEST_TRANSACTION_HASH = '88beb0783e394f6128699bad42906374ab64197d260db05bb0cfeeb518ba3ac2';
|
|
5
|
+
const authContext = {
|
|
6
|
+
userId: 'test-user-id',
|
|
7
|
+
accessToken: 'test-access-token',
|
|
8
|
+
};
|
|
9
|
+
test('driver properties', async () => {
|
|
10
|
+
const signingDriver = new ParticipantSigningDriver();
|
|
11
|
+
expect(signingDriver.partyMode).toBe('internal');
|
|
12
|
+
expect(signingDriver.signingProvider).toBe('participant');
|
|
13
|
+
});
|
|
14
|
+
test('transaction signature', async () => {
|
|
15
|
+
const signingDriver = new ParticipantSigningDriver();
|
|
16
|
+
const tx = await signingDriver
|
|
17
|
+
.controller(authContext.userId)
|
|
18
|
+
.signTransaction({
|
|
19
|
+
tx: TEST_TRANSACTION,
|
|
20
|
+
txHash: TEST_TRANSACTION_HASH,
|
|
21
|
+
publicKey: '',
|
|
22
|
+
});
|
|
23
|
+
expect(tx.status).toBe('signed');
|
|
24
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './controller.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@canton-network/core-signing-participant",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"packageManager": "yarn@4.9.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc -b",
|
|
10
|
+
"clean": "tsc -b --clean && rm -rf ./dist",
|
|
11
|
+
"test": "yarn node --experimental-vm-modules $(yarn bin jest) --passWithNoTests"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@canton-network/core-ledger-client": "^0.1.0",
|
|
15
|
+
"@canton-network/core-signing-lib": "^0.1.0",
|
|
16
|
+
"@canton-network/core-wallet-auth": "^0.1.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@jest/globals": "^29.0.0",
|
|
20
|
+
"@swc/core": "^1.11.31",
|
|
21
|
+
"@swc/jest": "^0.2.38",
|
|
22
|
+
"@types/fs-extra": "^11",
|
|
23
|
+
"@types/jest": "^29.5.14",
|
|
24
|
+
"@types/lodash": "^4.17.17",
|
|
25
|
+
"@types/node": "^22.15.29",
|
|
26
|
+
"jest": "^29.7.0",
|
|
27
|
+
"ts-jest-resolver": "^2.0.1",
|
|
28
|
+
"typescript": "^5.8.3"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/*"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|