@canton-network/wallet-gateway-remote 1.6.0 → 1.8.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/README.md +27 -2
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +27 -12
- package/dist/dapp-api/controller.test.js +23 -6
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +24 -12
- package/dist/env.d.ts +9 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +9 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +33 -1
- package/dist/ledger/transaction-service.d.ts +1 -12
- package/dist/ledger/transaction-service.d.ts.map +1 -1
- package/dist/ledger/transaction-service.js +114 -43
- package/dist/ledger/transaction-service.test.js +105 -26
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts +18 -0
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts.map +1 -0
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.js +130 -0
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts +1 -0
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/wallet-allocation-service.js +15 -0
- package/dist/ledger/wallet-allocation/wallet-allocation-service.test.js +88 -0
- package/dist/ledger/wallet-sync-service.test.js +2 -1
- package/dist/middleware/apiKeyAuth.d.ts.map +1 -1
- package/dist/middleware/apiKeyAuth.js +12 -3
- package/dist/middleware/securityHeaders.d.ts +3 -0
- package/dist/middleware/securityHeaders.d.ts.map +1 -0
- package/dist/middleware/securityHeaders.js +10 -0
- package/dist/middleware/securityHeaders.test.d.ts +2 -0
- package/dist/middleware/securityHeaders.test.d.ts.map +1 -0
- package/dist/middleware/securityHeaders.test.js +18 -0
- package/dist/middleware/sessionHandler.d.ts.map +1 -1
- package/dist/middleware/sessionHandler.js +3 -1
- package/dist/signing/signing-worker.d.ts +1 -2
- package/dist/signing/signing-worker.d.ts.map +1 -1
- package/dist/signing/signing-worker.js +7 -3
- package/dist/signing/signing-worker.test.js +2 -0
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +109 -50
- package/dist/user-api/controller.test.js +227 -19
- package/dist/user-api/rpc-gen/typings.d.ts +47 -8
- package/dist/user-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/user-api/token-network-matching.d.ts +4 -0
- package/dist/user-api/token-network-matching.d.ts.map +1 -0
- package/dist/user-api/token-network-matching.js +56 -0
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/activities/index.html +3 -4
- package/dist/web/frontend/approve/index.html +3 -5
- package/dist/web/frontend/assets/404-DAyFyvuw.js +5 -0
- package/dist/web/frontend/assets/activities-BQSNQCP2.js +61 -0
- package/dist/web/frontend/assets/addIdentityProvider-Djya4QfT.js +28 -0
- package/dist/web/frontend/assets/addNetwork-83_QwE58.js +38 -0
- package/dist/web/frontend/assets/addParty-CdxWCt0U.js +45 -0
- package/dist/web/frontend/assets/approve-NcV61aZJ.js +21 -0
- package/dist/web/frontend/assets/callback-U_3ypVos.js +3 -0
- package/dist/web/frontend/assets/identityProviders-CIk5SJX_.js +71 -0
- package/dist/web/frontend/assets/index-BjhQnXf1.js +2 -0
- package/dist/web/frontend/assets/index-jHlzHNRR.js +91 -0
- package/dist/web/frontend/assets/{index-CFnOucPK.js → index-uxv_f8PV.js} +631 -572
- package/dist/web/frontend/assets/login-C_JAX4Df.js +10 -0
- package/dist/web/frontend/assets/networks-C1kpJNtZ.js +73 -0
- package/dist/web/frontend/assets/reviewIdentityProvider-BZv-CbZZ.js +43 -0
- package/dist/web/frontend/assets/reviewNetwork-CnoSJz4N.js +43 -0
- package/dist/web/frontend/assets/settings-Dt0_RW30.js +37 -0
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/identity-providers/add/index.html +2 -3
- package/dist/web/frontend/identity-providers/index.html +2 -3
- package/dist/web/frontend/identity-providers/review/index.html +2 -3
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +2 -3
- package/dist/web/frontend/networks/add/index.html +2 -3
- package/dist/web/frontend/networks/index.html +2 -3
- package/dist/web/frontend/networks/review/index.html +2 -3
- package/dist/web/frontend/parties/add/index.html +3 -5
- package/dist/web/frontend/parties/index.html +2 -4
- package/dist/web/frontend/settings/index.html +2 -3
- package/dist/web/server.d.ts +1 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +3 -3
- package/package.json +30 -29
- package/dist/web/frontend/assets/404-C4hCL2o8.js +0 -5
- package/dist/web/frontend/assets/activities-Bq7yMMQY.js +0 -61
- package/dist/web/frontend/assets/addIdentityProvider-DRJWLhHF.js +0 -28
- package/dist/web/frontend/assets/addNetwork-CJUaKP1q.js +0 -38
- package/dist/web/frontend/assets/addParty-2ObTLGIL.js +0 -45
- package/dist/web/frontend/assets/approve-BuA5DGC2.js +0 -21
- package/dist/web/frontend/assets/callback-C5vJWFLq.js +0 -1
- package/dist/web/frontend/assets/identityProviders-78FbpzYL.js +0 -71
- package/dist/web/frontend/assets/index-BTH_md6b.js +0 -91
- package/dist/web/frontend/assets/index-CiMGhYb1.js +0 -2
- package/dist/web/frontend/assets/login-Dyn1o6fW.js +0 -10
- package/dist/web/frontend/assets/networks-_el10AWP.js +0 -73
- package/dist/web/frontend/assets/reviewIdentityProvider-DodUZ2mY.js +0 -43
- package/dist/web/frontend/assets/reviewNetwork-BFMtmKEL.js +0 -43
- package/dist/web/frontend/assets/settings-BBmkIfYm.js +0 -37
- package/dist/web/frontend/assets/state-DkxLvywv.js +0 -1
- package/dist/web/frontend/assets/utils-DvJKIYxT.js +0 -1
|
@@ -4,6 +4,7 @@ import { LedgerClient } from '@canton-network/core-ledger-client';
|
|
|
4
4
|
import { SigningProvider, } from '@canton-network/core-signing-lib';
|
|
5
5
|
import { ledgerPrepareParams, logDynamically, } from '../utils.js';
|
|
6
6
|
import { AuthTokenProvider, } from '@canton-network/core-wallet-auth';
|
|
7
|
+
import { keyLabelFromPublicKey } from '@canton-network/core-signing-securosys';
|
|
7
8
|
function handleSigningError(result) {
|
|
8
9
|
if ('error' in result) {
|
|
9
10
|
throw new Error(`Error from signing driver: ${result.error_description}`);
|
|
@@ -25,7 +26,7 @@ export class TransactionService {
|
|
|
25
26
|
}
|
|
26
27
|
switch (signingProvider) {
|
|
27
28
|
case SigningProvider.PARTICIPANT: {
|
|
28
|
-
return this.signWithParticipant(wallet);
|
|
29
|
+
return this.signWithParticipant(wallet, signParams);
|
|
29
30
|
}
|
|
30
31
|
case SigningProvider.WALLET_KERNEL: {
|
|
31
32
|
return this.signWithWalletKernel(authContext.userId, wallet, signParams);
|
|
@@ -42,13 +43,16 @@ export class TransactionService {
|
|
|
42
43
|
case SigningProvider.DFNS: {
|
|
43
44
|
return this.signWithDfns(authContext.userId, wallet, signParams);
|
|
44
45
|
}
|
|
46
|
+
case SigningProvider.SECUROSYS: {
|
|
47
|
+
return this.signWithSecurosys(authContext.userId, wallet, signParams);
|
|
48
|
+
}
|
|
45
49
|
default:
|
|
46
50
|
throw new Error(`Unsupported signing provider: ${wallet.signingProviderId}`);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
execute(userId, wallet, transaction, executeParams, ledgerClient, network) {
|
|
50
|
-
if (transaction.status
|
|
51
|
-
throw new Error(
|
|
54
|
+
if (transaction.status !== 'signed') {
|
|
55
|
+
throw new Error(`Cannot execute a ${transaction.status} transaction. Expected status: signed.`);
|
|
52
56
|
}
|
|
53
57
|
switch (wallet.signingProviderId) {
|
|
54
58
|
case SigningProvider.PARTICIPANT: {
|
|
@@ -71,7 +75,9 @@ export class TransactionService {
|
|
|
71
75
|
}
|
|
72
76
|
case SigningProvider.WALLET_KERNEL:
|
|
73
77
|
case SigningProvider.BLOCKDAEMON:
|
|
74
|
-
case SigningProvider.FIREBLOCKS:
|
|
78
|
+
case SigningProvider.FIREBLOCKS:
|
|
79
|
+
case SigningProvider.DFNS:
|
|
80
|
+
case SigningProvider.SECUROSYS: {
|
|
75
81
|
if (!executeParams) {
|
|
76
82
|
throw new Error('Execute params are required for external signing');
|
|
77
83
|
}
|
|
@@ -80,9 +86,6 @@ export class TransactionService {
|
|
|
80
86
|
}
|
|
81
87
|
return this.executeWithExternal(userId, executeParams, transaction, ledgerClient);
|
|
82
88
|
}
|
|
83
|
-
case SigningProvider.DFNS: {
|
|
84
|
-
return this.executeWithDfns(transaction);
|
|
85
|
-
}
|
|
86
89
|
default:
|
|
87
90
|
throw new Error(`Unsupported signing provider: ${wallet.signingProviderId}`);
|
|
88
91
|
}
|
|
@@ -117,7 +120,7 @@ export class TransactionService {
|
|
|
117
120
|
const userId = authContext.isApiKey
|
|
118
121
|
? authContext.ledgerUserId
|
|
119
122
|
: authContext.userId;
|
|
120
|
-
return this.execute(userId, wallet, transaction, executeParams, ledgerClient, network);
|
|
123
|
+
return this.execute(userId, wallet, { ...transaction, status: 'signed' }, executeParams, ledgerClient, network);
|
|
121
124
|
}
|
|
122
125
|
async loadPreparedTransactionForSigning(transactionId) {
|
|
123
126
|
const existingTx = await this.store.getTransaction(transactionId);
|
|
@@ -129,7 +132,27 @@ export class TransactionService {
|
|
|
129
132
|
}
|
|
130
133
|
return existingTx;
|
|
131
134
|
}
|
|
132
|
-
|
|
135
|
+
// This doesn't really sign the transaction.
|
|
136
|
+
// For participant both signing and execution are handled by /v2/commands/submit-and-wait using participant keys
|
|
137
|
+
// This behavior is unique to signing provider participant.
|
|
138
|
+
// This step intended for making participant wallets conform to a common API.
|
|
139
|
+
async signWithParticipant(wallet, signParams) {
|
|
140
|
+
const tx = await this.loadPreparedTransactionForSigning(signParams.transactionId);
|
|
141
|
+
const now = new Date();
|
|
142
|
+
const signedTx = {
|
|
143
|
+
id: tx.id,
|
|
144
|
+
commandId: tx.commandId,
|
|
145
|
+
status: 'signed',
|
|
146
|
+
preparedTransaction: tx.preparedTransaction,
|
|
147
|
+
preparedTransactionHash: tx.preparedTransactionHash,
|
|
148
|
+
origin: tx?.origin ?? null,
|
|
149
|
+
...(tx?.createdAt && {
|
|
150
|
+
createdAt: tx.createdAt,
|
|
151
|
+
}),
|
|
152
|
+
signedAt: now,
|
|
153
|
+
};
|
|
154
|
+
await this.store.setTransactionSigned(tx.id, now);
|
|
155
|
+
this.notifier.emit('txChanged', signedTx);
|
|
133
156
|
return {
|
|
134
157
|
status: 'signed',
|
|
135
158
|
signature: 'none',
|
|
@@ -354,12 +377,6 @@ export class TransactionService {
|
|
|
354
377
|
};
|
|
355
378
|
}
|
|
356
379
|
}
|
|
357
|
-
/**
|
|
358
|
-
* Dfns broadcasts the prepared transaction to Canton itself, so we get back
|
|
359
|
-
* an updateId rather than a raw signature. We persist the updateId as the
|
|
360
|
-
* signature payload (the controller short-circuits Dfns execute) and surface
|
|
361
|
-
* the same SignResult shape the other external providers use.
|
|
362
|
-
*/
|
|
363
380
|
async signWithDfns(userId, wallet, signParams) {
|
|
364
381
|
const signingProvider = this.signingDrivers[SigningProvider.DFNS];
|
|
365
382
|
if (!signingProvider) {
|
|
@@ -394,7 +411,7 @@ export class TransactionService {
|
|
|
394
411
|
});
|
|
395
412
|
if (signingResult.status === 'signed') {
|
|
396
413
|
if (!signingResult.signature) {
|
|
397
|
-
throw new Error('No
|
|
414
|
+
throw new Error('No signature returned from Dfns signing driver');
|
|
398
415
|
}
|
|
399
416
|
const signedTx = {
|
|
400
417
|
id: tx.id,
|
|
@@ -444,35 +461,89 @@ export class TransactionService {
|
|
|
444
461
|
};
|
|
445
462
|
}
|
|
446
463
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
*/
|
|
452
|
-
async executeWithDfns(transaction) {
|
|
453
|
-
if (!transaction.externalTxId) {
|
|
454
|
-
throw new Error('Cannot execute Dfns transaction without externalTxId from Dfns');
|
|
464
|
+
async signWithSecurosys(userId, wallet, signParams) {
|
|
465
|
+
const signingProvider = this.signingDrivers[SigningProvider.SECUROSYS];
|
|
466
|
+
if (!signingProvider) {
|
|
467
|
+
throw new Error('Securosys signing driver not available');
|
|
455
468
|
}
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
469
|
+
const driver = signingProvider.controller(userId);
|
|
470
|
+
const tx = await this.loadPreparedTransactionForSigning(signParams.transactionId);
|
|
471
|
+
let signingResult;
|
|
472
|
+
if (tx.externalTxId) {
|
|
473
|
+
signingResult = await driver
|
|
474
|
+
.getTransaction({
|
|
475
|
+
txId: tx.externalTxId,
|
|
476
|
+
})
|
|
477
|
+
.then(handleSigningError);
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
signingResult = await driver
|
|
481
|
+
.signTransaction({
|
|
482
|
+
tx: tx.preparedTransaction,
|
|
483
|
+
txHash: tx.preparedTransactionHash,
|
|
484
|
+
keyIdentifier: {
|
|
485
|
+
id: keyLabelFromPublicKey(wallet.publicKey),
|
|
486
|
+
publicKey: wallet.publicKey,
|
|
487
|
+
},
|
|
488
|
+
})
|
|
489
|
+
.then(handleSigningError);
|
|
490
|
+
}
|
|
491
|
+
const now = new Date();
|
|
492
|
+
logDynamically(this.logger, 'Securosys signing result', {
|
|
493
|
+
info: { transactionId: tx.id, status: signingResult.status },
|
|
494
|
+
debug: { signingResult, tx },
|
|
473
495
|
});
|
|
474
|
-
|
|
475
|
-
|
|
496
|
+
if (signingResult.status === 'signed') {
|
|
497
|
+
if (!signingResult.signature) {
|
|
498
|
+
throw new Error('No signature returned from signing driver');
|
|
499
|
+
}
|
|
500
|
+
const signedTx = {
|
|
501
|
+
id: tx.id,
|
|
502
|
+
commandId: tx.commandId,
|
|
503
|
+
status: signingResult.status,
|
|
504
|
+
preparedTransaction: tx.preparedTransaction,
|
|
505
|
+
preparedTransactionHash: tx.preparedTransactionHash,
|
|
506
|
+
origin: tx?.origin ?? null,
|
|
507
|
+
...(tx?.createdAt && {
|
|
508
|
+
createdAt: tx.createdAt,
|
|
509
|
+
}),
|
|
510
|
+
signedAt: now,
|
|
511
|
+
externalTxId: signingResult.txId,
|
|
512
|
+
};
|
|
513
|
+
await this.store.setTransactionSigned(tx.id, now, signingResult.txId);
|
|
514
|
+
this.notifier.emit('txChanged', signedTx);
|
|
515
|
+
return {
|
|
516
|
+
status: signingResult.status,
|
|
517
|
+
signature: signingResult.signature,
|
|
518
|
+
signedBy: wallet.namespace,
|
|
519
|
+
partyId: wallet.partyId,
|
|
520
|
+
externalTxId: signingResult.txId,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
const status = signingResult.status === 'pending' ? 'pending' : 'failed';
|
|
525
|
+
const pendingTx = {
|
|
526
|
+
id: tx.id,
|
|
527
|
+
commandId: tx.commandId,
|
|
528
|
+
status,
|
|
529
|
+
preparedTransaction: tx.preparedTransaction,
|
|
530
|
+
preparedTransactionHash: tx.preparedTransactionHash,
|
|
531
|
+
externalTxId: signingResult.txId,
|
|
532
|
+
origin: tx?.origin ?? null,
|
|
533
|
+
...(tx?.createdAt && {
|
|
534
|
+
createdAt: tx.createdAt,
|
|
535
|
+
}),
|
|
536
|
+
};
|
|
537
|
+
await this.store.setTransactionStatus(tx.id, status, {
|
|
538
|
+
externalTxId: signingResult.txId,
|
|
539
|
+
});
|
|
540
|
+
this.notifier.emit('txChanged', pendingTx);
|
|
541
|
+
return {
|
|
542
|
+
status: signingResult.status,
|
|
543
|
+
externalTxId: signingResult.txId,
|
|
544
|
+
partyId: wallet.partyId,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
476
547
|
}
|
|
477
548
|
async executeWithParticipant(userId, executeParams, transaction, ledgerClient, network) {
|
|
478
549
|
const { partyId } = executeParams;
|
|
@@ -33,6 +33,15 @@ const pendingTransaction = {
|
|
|
33
33
|
origin: 'https://dapp.example',
|
|
34
34
|
createdAt: new Date('2026-01-01T00:00:00.000Z'),
|
|
35
35
|
};
|
|
36
|
+
const signedTransaction = {
|
|
37
|
+
...pendingTransaction,
|
|
38
|
+
status: 'signed',
|
|
39
|
+
signedAt: new Date('2026-01-01T00:01:00.000Z'),
|
|
40
|
+
};
|
|
41
|
+
const executedTransaction = {
|
|
42
|
+
...pendingTransaction,
|
|
43
|
+
status: 'executed',
|
|
44
|
+
};
|
|
36
45
|
const signParams = {
|
|
37
46
|
transactionId: pendingTransaction.id,
|
|
38
47
|
partyId: wallet.partyId,
|
|
@@ -93,7 +102,7 @@ describe('TransactionService', () => {
|
|
|
93
102
|
});
|
|
94
103
|
describe('sign', () => {
|
|
95
104
|
describe('participant', () => {
|
|
96
|
-
it('returns a signed result
|
|
105
|
+
it('returns a signed result and persists signed status', async () => {
|
|
97
106
|
const store = createStore();
|
|
98
107
|
const service = createService(store, {
|
|
99
108
|
[SigningProvider.PARTICIPANT]: createDriver({}),
|
|
@@ -106,7 +115,12 @@ describe('TransactionService', () => {
|
|
|
106
115
|
signedBy: wallet.namespace,
|
|
107
116
|
partyId: wallet.partyId,
|
|
108
117
|
});
|
|
109
|
-
expect(store.getTransaction).
|
|
118
|
+
expect(store.getTransaction).toHaveBeenCalledWith(pendingTransaction.id);
|
|
119
|
+
expect(store.setTransactionSigned).toHaveBeenCalledWith(pendingTransaction.id, expect.any(Date));
|
|
120
|
+
expect(emit).toHaveBeenCalledWith('txChanged', expect.objectContaining({
|
|
121
|
+
id: pendingTransaction.id,
|
|
122
|
+
status: 'signed',
|
|
123
|
+
}));
|
|
110
124
|
});
|
|
111
125
|
});
|
|
112
126
|
describe('wallet-kernel', () => {
|
|
@@ -249,11 +263,11 @@ describe('TransactionService', () => {
|
|
|
249
263
|
});
|
|
250
264
|
});
|
|
251
265
|
describe('dfns', () => {
|
|
252
|
-
it('
|
|
266
|
+
it('returns the driver signature when signing completes', async () => {
|
|
253
267
|
const signTransaction = vi.fn().mockResolvedValue({
|
|
254
268
|
status: 'signed',
|
|
255
269
|
txId: 'dfns-tx-1',
|
|
256
|
-
signature: '
|
|
270
|
+
signature: 'dfns-signature',
|
|
257
271
|
});
|
|
258
272
|
const store = createStore();
|
|
259
273
|
const service = createService(store, {
|
|
@@ -264,39 +278,98 @@ describe('TransactionService', () => {
|
|
|
264
278
|
const result = await service.sign(authContext, walletWithProvider(SigningProvider.DFNS), signParams);
|
|
265
279
|
expect(result).toEqual({
|
|
266
280
|
status: 'signed',
|
|
267
|
-
signature: '
|
|
281
|
+
signature: 'dfns-signature',
|
|
268
282
|
signedBy: wallet.namespace,
|
|
269
283
|
partyId: wallet.partyId,
|
|
270
284
|
externalTxId: 'dfns-tx-1',
|
|
271
285
|
});
|
|
272
286
|
});
|
|
273
287
|
});
|
|
288
|
+
describe('securosys', () => {
|
|
289
|
+
it('starts signing and persists the TSB request id when signing is pending', async () => {
|
|
290
|
+
const signTransaction = vi.fn().mockResolvedValue({
|
|
291
|
+
status: 'pending',
|
|
292
|
+
txId: 'tsb-request-1',
|
|
293
|
+
});
|
|
294
|
+
const store = createStore();
|
|
295
|
+
const service = createService(store, {
|
|
296
|
+
[SigningProvider.SECUROSYS]: createDriver({
|
|
297
|
+
signTransaction,
|
|
298
|
+
}),
|
|
299
|
+
}, notifier, logger);
|
|
300
|
+
const result = await service.sign(authContext, walletWithProvider(SigningProvider.SECUROSYS), signParams);
|
|
301
|
+
expect(signTransaction).toHaveBeenCalledWith({
|
|
302
|
+
tx: pendingTransaction.preparedTransaction,
|
|
303
|
+
txHash: pendingTransaction.preparedTransactionHash,
|
|
304
|
+
keyIdentifier: {
|
|
305
|
+
id: wallet.publicKey,
|
|
306
|
+
publicKey: wallet.publicKey,
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
expect(store.setTransactionStatus).toHaveBeenCalledWith(pendingTransaction.id, 'pending', { externalTxId: 'tsb-request-1' });
|
|
310
|
+
expect(result).toEqual({
|
|
311
|
+
status: 'pending',
|
|
312
|
+
externalTxId: 'tsb-request-1',
|
|
313
|
+
partyId: wallet.partyId,
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
it.each([
|
|
318
|
+
{
|
|
319
|
+
name: 'participant',
|
|
320
|
+
provider: SigningProvider.PARTICIPANT,
|
|
321
|
+
auth: authContext,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
name: 'wallet-kernel',
|
|
325
|
+
provider: SigningProvider.WALLET_KERNEL,
|
|
326
|
+
auth: authContext,
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'blockdaemon',
|
|
330
|
+
provider: SigningProvider.BLOCKDAEMON,
|
|
331
|
+
auth: authContextWithEmail,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: 'fireblocks',
|
|
335
|
+
provider: SigningProvider.FIREBLOCKS,
|
|
336
|
+
auth: authContext,
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'dfns',
|
|
340
|
+
provider: SigningProvider.DFNS,
|
|
341
|
+
auth: authContext,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'securosys',
|
|
345
|
+
provider: SigningProvider.SECUROSYS,
|
|
346
|
+
auth: authContext,
|
|
347
|
+
},
|
|
348
|
+
])('rejects signing an already executed transaction for $name', async ({ provider, auth }) => {
|
|
349
|
+
const store = createStore(executedTransaction);
|
|
350
|
+
const service = createService(store, {
|
|
351
|
+
[provider]: createDriver({}),
|
|
352
|
+
}, notifier, logger);
|
|
353
|
+
const providerWallet = walletWithProvider(provider);
|
|
354
|
+
await expect(service.sign(auth, providerWallet, signParams)).rejects.toThrow('Cannot sign an already executed transaction');
|
|
355
|
+
expect(store.setTransactionSigned).not.toHaveBeenCalled();
|
|
356
|
+
expect(store.setTransactionStatus).not.toHaveBeenCalled();
|
|
357
|
+
});
|
|
274
358
|
});
|
|
275
359
|
describe('execute', () => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const store = createStore(signedTransaction);
|
|
284
|
-
const service = createService(store, {}, notifier, logger);
|
|
285
|
-
const result = await service.execute(authContext.userId, walletWithProvider(SigningProvider.DFNS), signedTransaction);
|
|
286
|
-
expect(store.setTransactionStatus).toHaveBeenCalledWith(signedTransaction.id, 'executed', { externalTxId: 'dfns-update-id' });
|
|
287
|
-
expect(emit).toHaveBeenCalledWith('txChanged', expect.objectContaining({ status: 'executed' }));
|
|
288
|
-
expect(result).toEqual({ updateId: 'dfns-update-id' });
|
|
289
|
-
});
|
|
290
|
-
it('throws when the transaction has no external tx id', async () => {
|
|
291
|
-
const service = createService(createStore(), {}, notifier, logger);
|
|
292
|
-
await expect(service.execute(authContext.userId, walletWithProvider(SigningProvider.DFNS), pendingTransaction)).rejects.toThrow('Cannot execute Dfns transaction without externalTxId from Dfns');
|
|
293
|
-
});
|
|
360
|
+
it.each(['pending', 'failed', 'executed'])('throws when execute is called for a %s transaction', async (status) => {
|
|
361
|
+
const service = createService(createStore(), {}, notifier, logger);
|
|
362
|
+
const transaction = {
|
|
363
|
+
...pendingTransaction,
|
|
364
|
+
status,
|
|
365
|
+
};
|
|
366
|
+
expect(() => service.execute(authContext.userId, wallet, transaction, executeParams)).toThrow(`Cannot execute a ${status} transaction. Expected status: signed.`);
|
|
294
367
|
});
|
|
295
368
|
describe('participant', () => {
|
|
296
369
|
it('submits the prepared transaction to the ledger', async () => {
|
|
297
370
|
const participantWallet = walletWithProvider(SigningProvider.PARTICIPANT);
|
|
298
371
|
const transaction = {
|
|
299
|
-
...
|
|
372
|
+
...signedTransaction,
|
|
300
373
|
payload: {
|
|
301
374
|
commandId: pendingTransaction.commandId,
|
|
302
375
|
commands: [],
|
|
@@ -322,7 +395,13 @@ describe('TransactionService', () => {
|
|
|
322
395
|
});
|
|
323
396
|
});
|
|
324
397
|
describe('external signing providers', () => {
|
|
325
|
-
it(
|
|
398
|
+
it.each([
|
|
399
|
+
SigningProvider.WALLET_KERNEL,
|
|
400
|
+
SigningProvider.BLOCKDAEMON,
|
|
401
|
+
SigningProvider.FIREBLOCKS,
|
|
402
|
+
SigningProvider.DFNS,
|
|
403
|
+
SigningProvider.SECUROSYS,
|
|
404
|
+
])('executes with the provided signature for %s', async (signingProviderId) => {
|
|
326
405
|
const signedTransaction = {
|
|
327
406
|
...pendingTransaction,
|
|
328
407
|
status: 'signed',
|
|
@@ -335,7 +414,7 @@ describe('TransactionService', () => {
|
|
|
335
414
|
postWithRetry,
|
|
336
415
|
};
|
|
337
416
|
const service = createService(store, {}, notifier, logger);
|
|
338
|
-
const result = await service.execute(authContext.userId,
|
|
417
|
+
const result = await service.execute(authContext.userId, walletWithProvider(signingProviderId), signedTransaction, executeParams, ledgerClient, network);
|
|
339
418
|
expect(postWithRetry).toHaveBeenCalledWith('/v2/interactive-submission/executeAndWait', expect.objectContaining({
|
|
340
419
|
userId: authContext.userId,
|
|
341
420
|
preparedTransaction: pendingTransaction.preparedTransaction,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UserId } from '@canton-network/core-wallet-auth';
|
|
2
|
+
import { Store, Wallet } from '@canton-network/core-wallet-store';
|
|
3
|
+
import { SigningDriverInterface } from '@canton-network/core-signing-lib';
|
|
4
|
+
import { Logger } from 'pino';
|
|
5
|
+
import { PartyAllocationService } from '../../party-allocation-service.js';
|
|
6
|
+
import { PartyHint, Primary } from '../../../user-api/rpc-gen/typings.js';
|
|
7
|
+
import type { WalletAllocator } from '../wallet-allocation-service.js';
|
|
8
|
+
export declare class SecurosysWalletAllocator implements WalletAllocator {
|
|
9
|
+
private store;
|
|
10
|
+
private logger;
|
|
11
|
+
private partyAllocator;
|
|
12
|
+
private signingDriver;
|
|
13
|
+
constructor(store: Store, logger: Logger, partyAllocator: PartyAllocationService, signingDriver: SigningDriverInterface);
|
|
14
|
+
createWallet(userId: UserId, _email: string | undefined, partyHint: PartyHint, primary?: Primary): Promise<Wallet>;
|
|
15
|
+
allocateParty(userId: UserId, _email: string | undefined, existingWallet: Wallet): Promise<void>;
|
|
16
|
+
private finalizeWallet;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=securosys-wallet-allocator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"securosys-wallet-allocator.d.ts","sourceRoot":"","sources":["../../../../src/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAEH,sBAAsB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAYtE,qBAAa,wBAAyB,YAAW,eAAe;IAExD,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,aAAa;gBAHb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,sBAAsB,EACtC,aAAa,EAAE,sBAAsB;IAG3C,YAAY,CACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC;IA4DZ,aAAa,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;YA+DF,cAAc;CA+C/B"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { SigningProvider, } from '@canton-network/core-signing-lib';
|
|
4
|
+
import { WALLET_DISABLED_REASON } from '@canton-network/core-types';
|
|
5
|
+
function handleSigningError(result) {
|
|
6
|
+
if ('error' in result) {
|
|
7
|
+
throw new Error(`Error from signing driver: ${result.error_description}`);
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
export class SecurosysWalletAllocator {
|
|
12
|
+
constructor(store, logger, partyAllocator, signingDriver) {
|
|
13
|
+
this.store = store;
|
|
14
|
+
this.logger = logger;
|
|
15
|
+
this.partyAllocator = partyAllocator;
|
|
16
|
+
this.signingDriver = signingDriver;
|
|
17
|
+
}
|
|
18
|
+
async createWallet(userId, _email, partyHint, primary = false) {
|
|
19
|
+
const driver = this.signingDriver.controller(userId);
|
|
20
|
+
const key = await driver
|
|
21
|
+
.createKey({ name: partyHint })
|
|
22
|
+
.then(handleSigningError);
|
|
23
|
+
const namespace = this.partyAllocator.createFingerprintFromKey(key.publicKey);
|
|
24
|
+
const transactions = await this.partyAllocator.generateTopologyTransactions(partyHint, key.publicKey);
|
|
25
|
+
const topologyTransactions = transactions.topologyTransactions ?? [];
|
|
26
|
+
const internalTxId = crypto
|
|
27
|
+
.randomUUID()
|
|
28
|
+
.replace(/-/g, '')
|
|
29
|
+
.substring(0, 16);
|
|
30
|
+
const txPayload = JSON.stringify(topologyTransactions);
|
|
31
|
+
const { status, txId } = await driver
|
|
32
|
+
.signTransaction({
|
|
33
|
+
tx: Buffer.from(txPayload).toString('base64'),
|
|
34
|
+
txHash: transactions.multiHash,
|
|
35
|
+
keyIdentifier: { id: key.id, publicKey: key.publicKey },
|
|
36
|
+
internalTxId,
|
|
37
|
+
})
|
|
38
|
+
.then(handleSigningError);
|
|
39
|
+
const network = await this.store.getCurrentNetwork();
|
|
40
|
+
const walletBase = {
|
|
41
|
+
partyId: `${partyHint}::${namespace}`,
|
|
42
|
+
hint: partyHint,
|
|
43
|
+
namespace,
|
|
44
|
+
signingProviderId: SigningProvider.SECUROSYS,
|
|
45
|
+
networkId: network.id,
|
|
46
|
+
primary,
|
|
47
|
+
publicKey: key.publicKey,
|
|
48
|
+
externalTxId: txId,
|
|
49
|
+
topologyTransactions: topologyTransactions.join(', '),
|
|
50
|
+
rights: [],
|
|
51
|
+
};
|
|
52
|
+
const wallet = await this.finalizeWallet(walletBase, userId, status, txId, topologyTransactions, namespace, driver);
|
|
53
|
+
await this.store.addWallet(wallet);
|
|
54
|
+
return wallet;
|
|
55
|
+
}
|
|
56
|
+
async allocateParty(userId, _email, existingWallet) {
|
|
57
|
+
if (!existingWallet.externalTxId ||
|
|
58
|
+
!existingWallet.topologyTransactions) {
|
|
59
|
+
throw new Error('Existing wallet is missing field externalTxId or topologyTransactions');
|
|
60
|
+
}
|
|
61
|
+
const driver = this.signingDriver.controller(userId);
|
|
62
|
+
const { signature, status, metadata } = await driver
|
|
63
|
+
.getTransaction({ txId: existingWallet.externalTxId })
|
|
64
|
+
.then(handleSigningError);
|
|
65
|
+
let walletUpdate = {
|
|
66
|
+
partyId: existingWallet.partyId,
|
|
67
|
+
networkId: existingWallet.networkId,
|
|
68
|
+
};
|
|
69
|
+
if (status === 'signed') {
|
|
70
|
+
if (!signature) {
|
|
71
|
+
throw new Error('Transaction signed but no signature found in result');
|
|
72
|
+
}
|
|
73
|
+
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(existingWallet.namespace, existingWallet.topologyTransactions.split(', '), signature, userId);
|
|
74
|
+
walletUpdate = {
|
|
75
|
+
...walletUpdate,
|
|
76
|
+
partyId,
|
|
77
|
+
status: 'allocated',
|
|
78
|
+
reason: '',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
else if (status === 'pending') {
|
|
82
|
+
walletUpdate = {
|
|
83
|
+
...walletUpdate,
|
|
84
|
+
status: 'initialized',
|
|
85
|
+
reason: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_PENDING,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.logger.warn(`Topology transaction for wallet ${existingWallet.partyId} was ${status} with ${JSON.stringify(metadata)}`);
|
|
90
|
+
const reason = status === 'rejected'
|
|
91
|
+
? WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_REJECTED
|
|
92
|
+
: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_FAILED;
|
|
93
|
+
walletUpdate = {
|
|
94
|
+
...walletUpdate,
|
|
95
|
+
status: 'removed',
|
|
96
|
+
disabled: true,
|
|
97
|
+
reason,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return this.store.updateWallet(walletUpdate);
|
|
101
|
+
}
|
|
102
|
+
async finalizeWallet(walletBase, userId, status, txId, topologyTransactions, namespace, driver) {
|
|
103
|
+
if (status === 'signed') {
|
|
104
|
+
const { signature } = await driver
|
|
105
|
+
.getTransaction({ txId })
|
|
106
|
+
.then(handleSigningError);
|
|
107
|
+
if (!signature) {
|
|
108
|
+
throw new Error('Transaction signed but no signature found in result');
|
|
109
|
+
}
|
|
110
|
+
const partyId = await this.partyAllocator.allocatePartyWithExistingWallet(namespace, topologyTransactions, signature, userId);
|
|
111
|
+
return { ...walletBase, partyId, status: 'allocated' };
|
|
112
|
+
}
|
|
113
|
+
if (status === 'pending') {
|
|
114
|
+
return {
|
|
115
|
+
...walletBase,
|
|
116
|
+
status: 'initialized',
|
|
117
|
+
reason: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_PENDING,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const reason = status === 'rejected'
|
|
121
|
+
? WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_REJECTED
|
|
122
|
+
: WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_FAILED;
|
|
123
|
+
return {
|
|
124
|
+
...walletBase,
|
|
125
|
+
status: 'removed',
|
|
126
|
+
disabled: true,
|
|
127
|
+
reason,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -17,6 +17,7 @@ export declare class WalletAllocationService {
|
|
|
17
17
|
private readonly fireblocksAllocator?;
|
|
18
18
|
private readonly blockdaemonAllocator?;
|
|
19
19
|
private readonly dfnsAllocator?;
|
|
20
|
+
private readonly securosysAllocator?;
|
|
20
21
|
constructor(store: Store, logger: Logger, partyAllocator: PartyAllocationService, signingDrivers?: Partial<Record<SigningProvider, SigningDriverInterface>>);
|
|
21
22
|
createWallet(authContext: AuthContext, partyHint: PartyHint, primary: Primary, signingProviderId: SigningProvider, vaultName?: VaultName | undefined): Promise<Wallet>;
|
|
22
23
|
allocateParty(authContext: AuthContext, existingWallet: Wallet, signingProviderId: SigningProvider): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-allocation-service.d.ts","sourceRoot":"","sources":["../../../src/ledger/wallet-allocation/wallet-allocation-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AACjE,OAAO,EACH,sBAAsB,EACtB,eAAe,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EACH,SAAS,EACT,OAAO,EACP,SAAS,EACZ,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"wallet-allocation-service.d.ts","sourceRoot":"","sources":["../../../src/ledger/wallet-allocation/wallet-allocation-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AACjE,OAAO,EACH,sBAAsB,EACtB,eAAe,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EACH,SAAS,EACT,OAAO,EACP,SAAS,EACZ,MAAM,mCAAmC,CAAA;AAQ1C,MAAM,WAAW,eAAe;IAC5B,YAAY,CACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAClC,OAAO,CAAC,MAAM,CAAC,CAAA;IAClB,aAAa,CACT,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAC5D;AAED,qBAAa,uBAAuB;IAChC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA4B;IACjE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAuB;IACxD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAA2B;IAChE,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAA4B;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAqB;IACpD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAA0B;gBAG1D,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,sBAAsB,EACtC,cAAc,GAAE,OAAO,CACnB,MAAM,CAAC,eAAe,EAAE,sBAAsB,CAAC,CAC7C;IA2DG,YAAY,CACrB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,iBAAiB,EAAE,eAAe,EAClC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAClC,OAAO,CAAC,MAAM,CAAC;IA+EL,aAAa,CACtB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,eAAe,GACnC,OAAO,CAAC,IAAI,CAAC;IAmEH,SAAS,CAClB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,eAAe,GACnC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAanC"}
|
|
@@ -6,6 +6,7 @@ import { KernelWalletAllocator } from './signing-providers/kernel-wallet-allocat
|
|
|
6
6
|
import { FireblocksWalletAllocator } from './signing-providers/fireblocks-wallet-allocator.js';
|
|
7
7
|
import { BlockdaemonWalletAllocator } from './signing-providers/blockdaemon-wallet-allocator.js';
|
|
8
8
|
import { DfnsWalletAllocator } from './signing-providers/dfns-wallet-allocator.js';
|
|
9
|
+
import { SecurosysWalletAllocator } from './signing-providers/securosys-wallet-allocator.js';
|
|
9
10
|
export class WalletAllocationService {
|
|
10
11
|
constructor(store, logger, partyAllocator, signingDrivers = {}) {
|
|
11
12
|
this.participantAllocator = new ParticipantWalletAllocator(store, logger, partyAllocator);
|
|
@@ -25,6 +26,10 @@ export class WalletAllocationService {
|
|
|
25
26
|
if (dfnsDriver) {
|
|
26
27
|
this.dfnsAllocator = new DfnsWalletAllocator(store, logger, partyAllocator, dfnsDriver);
|
|
27
28
|
}
|
|
29
|
+
const securosysDriver = signingDrivers[SigningProvider.SECUROSYS];
|
|
30
|
+
if (securosysDriver) {
|
|
31
|
+
this.securosysAllocator = new SecurosysWalletAllocator(store, logger, partyAllocator, securosysDriver);
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
async createWallet(authContext, partyHint, primary, signingProviderId, vaultName) {
|
|
30
35
|
switch (signingProviderId) {
|
|
@@ -56,6 +61,11 @@ export class WalletAllocationService {
|
|
|
56
61
|
throw new Error('Dfns signing driver not available');
|
|
57
62
|
}
|
|
58
63
|
return this.dfnsAllocator.createWallet(authContext.userId, authContext.email, partyHint, primary);
|
|
64
|
+
case SigningProvider.SECUROSYS:
|
|
65
|
+
if (!this.securosysAllocator) {
|
|
66
|
+
throw new Error('Securosys signing driver not available');
|
|
67
|
+
}
|
|
68
|
+
return this.securosysAllocator.createWallet(authContext.userId, authContext.email, partyHint, primary);
|
|
59
69
|
default:
|
|
60
70
|
throw new Error(`Unsupported signing provider: ${signingProviderId}`);
|
|
61
71
|
}
|
|
@@ -87,6 +97,11 @@ export class WalletAllocationService {
|
|
|
87
97
|
throw new Error('Dfns signing driver not available');
|
|
88
98
|
}
|
|
89
99
|
return this.dfnsAllocator.allocateParty(authContext.userId, authContext.email, existingWallet);
|
|
100
|
+
case SigningProvider.SECUROSYS:
|
|
101
|
+
if (!this.securosysAllocator) {
|
|
102
|
+
throw new Error('Securosys signing driver not available');
|
|
103
|
+
}
|
|
104
|
+
return this.securosysAllocator.allocateParty(authContext.userId, authContext.email, existingWallet);
|
|
90
105
|
default:
|
|
91
106
|
throw new Error(`Unsupported signing provider: ${signingProviderId}`);
|
|
92
107
|
}
|