@canton-network/wallet-gateway-remote 1.7.0 → 1.8.1
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/LICENSE +202 -0
- package/README.md +19 -1
- package/dist/env.d.ts +8 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +8 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +29 -0
- package/dist/ledger/transaction-service.d.ts +1 -0
- package/dist/ledger/transaction-service.d.ts.map +1 -1
- package/dist/ledger/transaction-service.js +90 -1
- package/dist/ledger/transaction-service.test.js +35 -0
- 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/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +27 -9
- package/dist/user-api/controller.test.js +82 -7
- package/dist/user-api/rpc-gen/typings.d.ts +1 -1
- package/dist/user-api/token-network-matching.d.ts.map +1 -1
- package/dist/user-api/token-network-matching.js +4 -3
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/activities/index.html +2 -2
- package/dist/web/frontend/approve/index.html +2 -2
- package/dist/web/frontend/assets/{404-C0zn3s5P.js → 404-eHe1UlAO.js} +1 -1
- package/dist/web/frontend/assets/{activities-BuOktGvz.js → activities-BNiyUauf.js} +1 -1
- package/dist/web/frontend/assets/{addIdentityProvider-D91uvfNz.js → addIdentityProvider-gTMI7Z0x.js} +1 -1
- package/dist/web/frontend/assets/{addNetwork-DP0iR59C.js → addNetwork-B82E7ioc.js} +3 -3
- package/dist/web/frontend/assets/{addParty-DUoPRmUF.js → addParty-CZcERPC7.js} +3 -3
- package/dist/web/frontend/assets/{approve-BSMrd3FM.js → approve-msSywhWK.js} +1 -1
- package/dist/web/frontend/assets/{callback-oLJBpxTj.js → callback-DfNP22-V.js} +1 -1
- package/dist/web/frontend/assets/{identityProviders-DQlERLUf.js → identityProviders-BDguIzmc.js} +1 -1
- package/dist/web/frontend/assets/{index-BoxNLwXf.js → index-BT9e9Q96.js} +113 -113
- package/dist/web/frontend/assets/{index-D5Xh-WxM.js → index-ohjr2alM.js} +3 -3
- package/dist/web/frontend/assets/{login-GZTP8nvF.js → login-B9l6Znpd.js} +1 -1
- package/dist/web/frontend/assets/{networks-DHe8V-HP.js → networks-BdDz41wp.js} +2 -2
- package/dist/web/frontend/assets/{reviewIdentityProvider-tg2atORE.js → reviewIdentityProvider-C2mAfah_.js} +1 -1
- package/dist/web/frontend/assets/{reviewNetwork-ZZv-rrzm.js → reviewNetwork-DcGIAg6z.js} +1 -1
- package/dist/web/frontend/assets/{settings-BC6X9ar3.js → settings-DCnHy29n.js} +1 -1
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/identity-providers/add/index.html +2 -2
- package/dist/web/frontend/identity-providers/index.html +2 -2
- package/dist/web/frontend/identity-providers/review/index.html +2 -2
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +2 -2
- package/dist/web/frontend/networks/add/index.html +2 -2
- package/dist/web/frontend/networks/index.html +2 -2
- package/dist/web/frontend/networks/review/index.html +2 -2
- package/dist/web/frontend/parties/add/index.html +3 -3
- package/dist/web/frontend/parties/index.html +2 -2
- package/dist/web/frontend/settings/index.html +2 -2
- package/package.json +43 -42
|
@@ -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
|
}
|
|
@@ -100,6 +100,30 @@ function createDfnsDriver(options) {
|
|
|
100
100
|
}),
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
function createSecurosysDriver(options) {
|
|
104
|
+
const createKeyResult = options.createKeyResult ?? {
|
|
105
|
+
id: 'key-1',
|
|
106
|
+
publicKey: 'securosys-pk',
|
|
107
|
+
};
|
|
108
|
+
const signTransactionResult = options.signTransactionResult ?? {
|
|
109
|
+
status: 'pending',
|
|
110
|
+
txId: 'tx-1',
|
|
111
|
+
};
|
|
112
|
+
const getTransactionResult = options.getTransactionResult ?? signTransactionResult;
|
|
113
|
+
return {
|
|
114
|
+
controller: vi.fn().mockReturnValue({
|
|
115
|
+
createKey: vi
|
|
116
|
+
.fn()
|
|
117
|
+
.mockResolvedValue(createKeyResult),
|
|
118
|
+
signTransaction: vi
|
|
119
|
+
.fn()
|
|
120
|
+
.mockResolvedValue(signTransactionResult),
|
|
121
|
+
getTransaction: vi
|
|
122
|
+
.fn()
|
|
123
|
+
.mockResolvedValue(getTransactionResult),
|
|
124
|
+
}),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
103
127
|
describe('WalletAllocationService', () => {
|
|
104
128
|
let mockLogger;
|
|
105
129
|
let mockStore;
|
|
@@ -830,4 +854,68 @@ describe('WalletAllocationService', () => {
|
|
|
830
854
|
});
|
|
831
855
|
});
|
|
832
856
|
});
|
|
857
|
+
describe('Securosys', () => {
|
|
858
|
+
it('throws when Securosys signing driver not available', async () => {
|
|
859
|
+
const serviceWithoutSecurosys = createService({});
|
|
860
|
+
await expect(serviceWithoutSecurosys.createWallet(authContext, 'alice', false, SigningProvider.SECUROSYS)).rejects.toThrow('Securosys signing driver not available');
|
|
861
|
+
});
|
|
862
|
+
it('createWallet returns initialized when signTransaction returns pending', async () => {
|
|
863
|
+
const driver = createSecurosysDriver({
|
|
864
|
+
createKeyResult: {
|
|
865
|
+
id: 'alice-key',
|
|
866
|
+
publicKey: 'securosys-pk',
|
|
867
|
+
},
|
|
868
|
+
signTransactionResult: {
|
|
869
|
+
status: 'pending',
|
|
870
|
+
txId: 'tsb-request-1',
|
|
871
|
+
},
|
|
872
|
+
});
|
|
873
|
+
const serviceWithSecurosys = createService({
|
|
874
|
+
[SigningProvider.SECUROSYS]: driver,
|
|
875
|
+
});
|
|
876
|
+
const result = await serviceWithSecurosys.createWallet(authContext, 'alice', false, SigningProvider.SECUROSYS);
|
|
877
|
+
const controller = vi.mocked(driver.controller).mock.results[0]
|
|
878
|
+
?.value;
|
|
879
|
+
expect(controller.createKey).toHaveBeenCalledWith({
|
|
880
|
+
name: 'alice',
|
|
881
|
+
});
|
|
882
|
+
expect(controller.signTransaction).toHaveBeenCalledWith(expect.objectContaining({
|
|
883
|
+
txHash: 'hash',
|
|
884
|
+
keyIdentifier: {
|
|
885
|
+
id: 'alice-key',
|
|
886
|
+
publicKey: 'securosys-pk',
|
|
887
|
+
},
|
|
888
|
+
}));
|
|
889
|
+
expect(result.status).toBe('initialized');
|
|
890
|
+
expect(result.reason).toBe(WALLET_DISABLED_REASON.TOPOLOGY_TRANSACTION_PENDING);
|
|
891
|
+
expect(result.signingProviderId).toBe(SigningProvider.SECUROSYS);
|
|
892
|
+
expect(result.externalTxId).toBe('tsb-request-1');
|
|
893
|
+
expect(mockStore.addWallet).toHaveBeenCalled();
|
|
894
|
+
});
|
|
895
|
+
it('allocateParty updates wallet to allocated when transaction is signed', async () => {
|
|
896
|
+
const serviceWithSecurosys = createService({
|
|
897
|
+
[SigningProvider.SECUROSYS]: createSecurosysDriver({
|
|
898
|
+
getTransactionResult: {
|
|
899
|
+
txId: 'tsb-request-1',
|
|
900
|
+
status: 'signed',
|
|
901
|
+
signature: 'sig-base64',
|
|
902
|
+
},
|
|
903
|
+
}),
|
|
904
|
+
});
|
|
905
|
+
mockPartyAllocator.allocatePartyWithExistingWallet.mockResolvedValue('alice::namespace');
|
|
906
|
+
await serviceWithSecurosys.allocateParty(authContext, createWallet('alice::fingerprint', {
|
|
907
|
+
signingProviderId: SigningProvider.SECUROSYS,
|
|
908
|
+
namespace: 'fingerprint',
|
|
909
|
+
topologyTransactions: 'tx1',
|
|
910
|
+
externalTxId: 'tsb-request-1',
|
|
911
|
+
}), SigningProvider.SECUROSYS);
|
|
912
|
+
expect(mockPartyAllocator.allocatePartyWithExistingWallet).toHaveBeenCalledWith('fingerprint', ['tx1'], 'sig-base64', authContext.userId);
|
|
913
|
+
expect(mockStore.updateWallet).toHaveBeenCalledWith({
|
|
914
|
+
networkId: 'network1',
|
|
915
|
+
partyId: 'alice::namespace',
|
|
916
|
+
status: 'allocated',
|
|
917
|
+
reason: '',
|
|
918
|
+
});
|
|
919
|
+
});
|
|
920
|
+
});
|
|
833
921
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/user-api/controller.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,KAAK,EAAW,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAEH,WAAW,EAKd,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/user-api/controller.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,KAAK,EAAW,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAEH,WAAW,EAKd,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAgBnE,eAAO,MAAM,cAAc,GACvB,YAAY,UAAU,EACtB,SAAS,MAAM,EACf,OAAO,KAAK,EACZ,qBAAqB,mBAAmB,EACxC,aAAa,WAAW,GAAG,SAAS,EACpC,SAAS,cAAc,EACvB,SAAS,MAAM,EACf,cAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAunCvB,CAAA"}
|
|
@@ -23,18 +23,34 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
23
23
|
providerType: kernelInfo.clientType,
|
|
24
24
|
userUrl: `${userUrl}/login/`,
|
|
25
25
|
};
|
|
26
|
+
function isAdmin() {
|
|
27
|
+
const userId = authContext?.userId;
|
|
28
|
+
return !!adminUserId && !!userId && userId === adminUserId;
|
|
29
|
+
}
|
|
26
30
|
function assertAdmin() {
|
|
27
31
|
const userId = assertConnected(authContext).userId;
|
|
28
32
|
if (!adminUserId || userId !== adminUserId) {
|
|
29
33
|
throw new Error('Unauthorized: only the admin user can perform this operation');
|
|
30
34
|
}
|
|
31
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Session responses always include user auth for the UI.
|
|
38
|
+
* Privileged credentials are included only for the admin user.
|
|
39
|
+
*/
|
|
40
|
+
function toSessionNetwork(network) {
|
|
41
|
+
const dto = toNetworkDto(network);
|
|
42
|
+
if (isAdmin()) {
|
|
43
|
+
return dto;
|
|
44
|
+
}
|
|
45
|
+
const { adminAuth: _adminAuth, serviceAccountAuth: _sa, ...rest } = dto;
|
|
46
|
+
return rest;
|
|
47
|
+
}
|
|
32
48
|
return buildController({
|
|
33
49
|
getUser: async () => {
|
|
34
50
|
const userId = assertConnected(authContext).userId;
|
|
35
51
|
return {
|
|
36
52
|
userId,
|
|
37
|
-
isAdmin:
|
|
53
|
+
isAdmin: isAdmin(),
|
|
38
54
|
};
|
|
39
55
|
},
|
|
40
56
|
addNetwork: async (params) => {
|
|
@@ -523,10 +539,7 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
523
539
|
return {
|
|
524
540
|
id: newSessionId,
|
|
525
541
|
accessToken,
|
|
526
|
-
network:
|
|
527
|
-
...network,
|
|
528
|
-
ledgerApi: network.ledgerApi.baseUrl,
|
|
529
|
-
},
|
|
542
|
+
network: toSessionNetwork(network),
|
|
530
543
|
idp,
|
|
531
544
|
status: status.isConnected ? 'connected' : 'disconnected',
|
|
532
545
|
reason: status.reason ? status.reason : 'OK',
|
|
@@ -585,10 +598,7 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
585
598
|
{
|
|
586
599
|
id: session.id,
|
|
587
600
|
origin: session.origin,
|
|
588
|
-
network:
|
|
589
|
-
...network,
|
|
590
|
-
ledgerApi: network.ledgerApi.baseUrl,
|
|
591
|
-
},
|
|
601
|
+
network: toSessionNetwork(network),
|
|
592
602
|
idp: idp,
|
|
593
603
|
accessToken: authContext.accessToken,
|
|
594
604
|
status: status.isConnected
|
|
@@ -729,7 +739,15 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
729
739
|
if (transaction.status !== 'pending') {
|
|
730
740
|
throw new Error(`Cannot delete transaction with status '${transaction.status}'. Only pending transactions can be deleted.`);
|
|
731
741
|
}
|
|
742
|
+
const session = await store.getSession(assertConnected(authContext).accessToken);
|
|
743
|
+
if (!session) {
|
|
744
|
+
throw new Error('No active session found');
|
|
745
|
+
}
|
|
732
746
|
await store.removeTransaction(transaction.id);
|
|
747
|
+
notificationService.getNotifier(session.id).emit('txChanged', {
|
|
748
|
+
status: 'failed',
|
|
749
|
+
commandId: transaction.commandId,
|
|
750
|
+
});
|
|
733
751
|
return null;
|
|
734
752
|
},
|
|
735
753
|
generateApiKey: async (params) => {
|
|
@@ -493,13 +493,20 @@ describe('userController', () => {
|
|
|
493
493
|
expect(result.transactions).toHaveLength(1);
|
|
494
494
|
expect(result.transactions[0]?.id).toBe('tx-1');
|
|
495
495
|
});
|
|
496
|
-
it('deletes a pending transaction', async () => {
|
|
496
|
+
it('deletes a pending transaction and emits a failed event', async () => {
|
|
497
497
|
const store = await createStore(logger, auth);
|
|
498
498
|
await store.setTransaction(transaction);
|
|
499
499
|
const removeSpy = vi.spyOn(store, 'removeTransaction');
|
|
500
|
+
const emitSpy = vi.spyOn(notificationService.getNotifier(session.id), 'emit');
|
|
500
501
|
const controller = createController(store, notificationService, logger, auth);
|
|
501
502
|
await controller.deleteTransaction({ transactionId: 'tx-1' });
|
|
502
503
|
expect(removeSpy).toHaveBeenCalledWith('tx-1');
|
|
504
|
+
expect(emitSpy).toHaveBeenCalledOnce();
|
|
505
|
+
expect(emitSpy).toHaveBeenCalledWith('txChanged', {
|
|
506
|
+
status: 'failed',
|
|
507
|
+
commandId: transaction.commandId,
|
|
508
|
+
});
|
|
509
|
+
expect(removeSpy.mock.invocationCallOrder[0]).toBeLessThan(emitSpy.mock.invocationCallOrder[0]);
|
|
503
510
|
});
|
|
504
511
|
it('rejects delete when the transaction is not pending', async () => {
|
|
505
512
|
const store = await createStore(logger, auth);
|
|
@@ -623,20 +630,47 @@ describe('userController', () => {
|
|
|
623
630
|
});
|
|
624
631
|
it('lists the current session with network status', async () => {
|
|
625
632
|
const store = await createStore(logger, auth);
|
|
626
|
-
const controller = createController(store, notificationService, logger, auth);
|
|
633
|
+
const controller = createController(store, notificationService, logger, auth, {}, adminUserId);
|
|
627
634
|
const result = await controller.listSessions();
|
|
628
635
|
expect(result.sessions).toHaveLength(1);
|
|
629
636
|
expect(result.sessions[0]).toMatchObject({
|
|
630
637
|
id: 'session-1',
|
|
631
638
|
status: 'connected',
|
|
639
|
+
accessToken: 'access-token-1',
|
|
632
640
|
network: expect.objectContaining({
|
|
633
641
|
id: 'network1',
|
|
634
642
|
ledgerApi: 'http://ledger.test',
|
|
643
|
+
auth: expect.objectContaining({
|
|
644
|
+
method: 'authorization_code',
|
|
645
|
+
clientId: 'cid',
|
|
646
|
+
}),
|
|
635
647
|
}),
|
|
636
648
|
idp,
|
|
637
649
|
});
|
|
650
|
+
expect(result.sessions[0].network).not.toHaveProperty('adminAuth');
|
|
651
|
+
expect(result.sessions[0].network).not.toHaveProperty('serviceAccountAuth');
|
|
638
652
|
expect(mockNetworkStatus).toHaveBeenCalled();
|
|
639
653
|
});
|
|
654
|
+
it('includes adminAuth in listSessions for the admin user', async () => {
|
|
655
|
+
const store = await createStore(logger, adminAuth, {
|
|
656
|
+
withSession: false,
|
|
657
|
+
});
|
|
658
|
+
await store.setSession({
|
|
659
|
+
...session,
|
|
660
|
+
accessToken: adminAuth.accessToken,
|
|
661
|
+
});
|
|
662
|
+
const controller = createController(store, notificationService, logger, adminAuth, {}, adminUserId);
|
|
663
|
+
const result = await controller.listSessions();
|
|
664
|
+
expect(result.sessions).toHaveLength(1);
|
|
665
|
+
expect(result.sessions[0].network).toMatchObject({
|
|
666
|
+
id: 'network1',
|
|
667
|
+
adminAuth: expect.objectContaining({
|
|
668
|
+
method: 'client_credentials',
|
|
669
|
+
clientId: 'admin-cid',
|
|
670
|
+
clientSecret: 'admin-secret',
|
|
671
|
+
}),
|
|
672
|
+
});
|
|
673
|
+
});
|
|
640
674
|
it('removeSession clears the session and emits statusChanged', async () => {
|
|
641
675
|
const store = await createStore(logger, auth);
|
|
642
676
|
const notifier = notificationService.getNotifier('session-1');
|
|
@@ -744,13 +778,21 @@ describe('userController', () => {
|
|
|
744
778
|
withWallet: false,
|
|
745
779
|
});
|
|
746
780
|
const controller = createController(store, notificationService, logger, authWithScopeOnly);
|
|
747
|
-
await
|
|
781
|
+
const result = await controller.addSession({
|
|
748
782
|
origin: 'dapp-1',
|
|
749
783
|
networkId: 'network1',
|
|
750
|
-
})
|
|
751
|
-
|
|
784
|
+
});
|
|
785
|
+
expect(result).toMatchObject({
|
|
786
|
+
network: expect.objectContaining({
|
|
787
|
+
id: 'network1',
|
|
788
|
+
auth: expect.objectContaining({
|
|
789
|
+
method: 'authorization_code',
|
|
790
|
+
}),
|
|
791
|
+
}),
|
|
752
792
|
status: 'connected',
|
|
753
793
|
});
|
|
794
|
+
expect(result.network).not.toHaveProperty('adminAuth');
|
|
795
|
+
expect(result.network).not.toHaveProperty('serviceAccountAuth');
|
|
754
796
|
});
|
|
755
797
|
it('addSession rejects when only scope is present and mismatches', async () => {
|
|
756
798
|
const authWithInvalidScope = createAuthWithAddSessionClaims({
|
|
@@ -806,9 +848,9 @@ describe('userController', () => {
|
|
|
806
848
|
networkId: 'network1',
|
|
807
849
|
})).rejects.toThrow('Failed to add session');
|
|
808
850
|
});
|
|
809
|
-
it('addSession rejects token with
|
|
851
|
+
it('addSession rejects token with client_id claim and auth.clientId mismatch', async () => {
|
|
810
852
|
const authWithInvalidSubject = createAuthWithAddSessionClaims({
|
|
811
|
-
|
|
853
|
+
client_id: 'wrong-client-id',
|
|
812
854
|
});
|
|
813
855
|
const store = await createStore(logger, authWithInvalidSubject, {
|
|
814
856
|
withWallet: false,
|
|
@@ -819,6 +861,39 @@ describe('userController', () => {
|
|
|
819
861
|
networkId: 'network1',
|
|
820
862
|
})).rejects.toThrow('Failed to add session');
|
|
821
863
|
});
|
|
864
|
+
it('addSession rejects token with azp claim and auth.clientId mismatch', async () => {
|
|
865
|
+
const authWithInvalidSubject = createAuthWithAddSessionClaims({
|
|
866
|
+
azp: 'wrong-client-id',
|
|
867
|
+
});
|
|
868
|
+
const store = await createStore(logger, authWithInvalidSubject, {
|
|
869
|
+
withWallet: false,
|
|
870
|
+
});
|
|
871
|
+
const controller = createController(store, notificationService, logger, authWithInvalidSubject);
|
|
872
|
+
await expect(controller.addSession({
|
|
873
|
+
origin: 'dapp-1',
|
|
874
|
+
networkId: 'network1',
|
|
875
|
+
})).rejects.toThrow('Failed to add session');
|
|
876
|
+
});
|
|
877
|
+
it("addSession passes when token doesn't token have azp and client-id claims", async () => {
|
|
878
|
+
const authWithInvalidSubject = createAuthWithAddSessionClaims();
|
|
879
|
+
const store = await createStore(logger, authWithInvalidSubject, {
|
|
880
|
+
withWallet: false,
|
|
881
|
+
});
|
|
882
|
+
const controller = createController(store, notificationService, logger, authWithInvalidSubject);
|
|
883
|
+
const result = await controller.addSession({
|
|
884
|
+
origin: 'dapp-1',
|
|
885
|
+
networkId: 'network1',
|
|
886
|
+
});
|
|
887
|
+
expect(result).toMatchObject({
|
|
888
|
+
network: expect.objectContaining({
|
|
889
|
+
id: 'network1',
|
|
890
|
+
auth: expect.objectContaining({
|
|
891
|
+
method: 'authorization_code',
|
|
892
|
+
}),
|
|
893
|
+
}),
|
|
894
|
+
status: 'connected',
|
|
895
|
+
});
|
|
896
|
+
});
|
|
822
897
|
});
|
|
823
898
|
describe('createWallet', () => {
|
|
824
899
|
const walletKernelDriver = {
|
|
@@ -60,7 +60,7 @@ export interface Auth {
|
|
|
60
60
|
export type LedgerApi = string;
|
|
61
61
|
/**
|
|
62
62
|
*
|
|
63
|
-
*
|
|
63
|
+
* Connected network metadata. Privileged credentials (adminAuth, serviceAccountAuth) are included only for the admin user.
|
|
64
64
|
*
|
|
65
65
|
*/
|
|
66
66
|
export interface Network {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-network-matching.d.ts","sourceRoot":"","sources":["../../src/user-api/token-network-matching.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAQ,MAAM,kCAAkC,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAwC3D,wBAAgB,6BAA6B,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,GACT,IAAI,
|
|
1
|
+
{"version":3,"file":"token-network-matching.d.ts","sourceRoot":"","sources":["../../src/user-api/token-network-matching.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAQ,MAAM,kCAAkC,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAwC3D,wBAAgB,6BAA6B,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,GACT,IAAI,CA4CN"}
|
|
@@ -35,9 +35,10 @@ export function assertTokenClaimsMatchNetwork(accessToken, network, idp) {
|
|
|
35
35
|
if (!tokenAudiences.includes(network.auth.audience)) {
|
|
36
36
|
throw new Error(`Token aud claim doesn't match network's auth audience.`);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
// check client ID based on `azp` (Authorized Party) claim or `client_id` claim, only if present.
|
|
39
|
+
const tokenClientId = tokenClaims.azp || tokenClaims.client_id;
|
|
40
|
+
if (tokenClientId && tokenClientId !== network.auth.clientId) {
|
|
41
|
+
throw new Error(`Token client ID doesn't match network's auth clientId.`);
|
|
41
42
|
}
|
|
42
43
|
const requiredScopes = normalizeScopeClaim(network.auth.scope);
|
|
43
44
|
const hasScopeClaim = tokenClaims.scope !== undefined;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wallet Gateway - Not found</title>
|
|
7
|
-
<script type="module" crossorigin src="../assets/404-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="../assets/index-
|
|
7
|
+
<script type="module" crossorigin src="../assets/404-eHe1UlAO.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="../assets/index-BT9e9Q96.js">
|
|
9
9
|
</head>
|
|
10
10
|
|
|
11
11
|
<body>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wallet Gateway - Activities</title>
|
|
7
|
-
<script type="module" crossorigin src="../assets/activities-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="../assets/index-
|
|
7
|
+
<script type="module" crossorigin src="../assets/activities-BNiyUauf.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="../assets/index-BT9e9Q96.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="../assets/index-BjhQnXf1.js">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wallet Gateway - Activity detail</title>
|
|
7
|
-
<script type="module" crossorigin src="../assets/approve-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="../assets/index-
|
|
7
|
+
<script type="module" crossorigin src="../assets/approve-msSywhWK.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="../assets/index-BT9e9Q96.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="../assets/index-BjhQnXf1.js">
|
|
10
10
|
</head>
|
|
11
11
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as h,i as z,O as E,b as I,t as j}from"./index-BT9e9Q96.js";var k=Object.create,s=Object.defineProperty,D=Object.getOwnPropertyDescriptor,y=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),O=r=>{throw TypeError(r)},F=(r,e,o)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,g=(r,e)=>s(r,"name",{value:e,configurable:!0}),A=r=>[,,,k(r?.[y("metadata")]??null)],C=["class","method","getter","setter","accessor","field","value","get","set"],x=r=>r!==void 0&&typeof r!="function"?O("Function expected"):r,M=(r,e,o,_,t)=>({kind:C[r],name:e,metadata:_,addInitializer:a=>o._?O("Already initialized"):t.push(x(a||null))}),N=(r,e)=>F(e,y("metadata"),r[3]),T=(r,e,o,_)=>{for(var t=0,a=r[e>>1],n=a&&a.length;t<n;t++)a[t].call(o);return _},$=(r,e,o,_,t,a)=>{var n,p,f,i=e&7,b=!1,m=0,P=r[m]||(r[m]=[]),c=i&&(t=t.prototype,i<5&&(i>3||!b)&&D(t,o));g(t,o);for(var d=_.length-1;d>=0;d--)f=M(i,o,p={},r[3],P),n=(0,_[d])(t,f),p._=1,x(n)&&(t=n);return N(r,t),c&&s(t,o,c),b?i^4?a:c:t},S,v,w;S=[j("user-ui-404")];const u=class u extends(w=h){render(){return I`<not-found href=${E("/")}></not-found>`}};u.styles=[h.styles,z`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,b as _,O as Y,s as Z,d as j,c as tt,a as at,o as et,
|
|
1
|
+
import{r as C,b as _,O as Y,s as Z,d as j,c as tt,a as at,o as et,v as N,i as it,t as st}from"./index-BT9e9Q96.js";import{p as rt}from"./index-BjhQnXf1.js";var nt=Object.create,I=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,R=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),v=a=>{throw TypeError(a)},ct=(a,t,e)=>t in a?I(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,F=(a,t)=>I(a,"name",{value:t,configurable:!0}),dt=a=>[,,,nt(a?.[R("metadata")]??null)],q=["class","method","getter","setter","accessor","field","value","get","set"],m=a=>a!==void 0&&typeof a!="function"?v("Function expected"):a,lt=(a,t,e,o,s)=>({kind:q[a],name:t,metadata:o,addInitializer:r=>e._?v("Already initialized"):s.push(m(r||null))}),pt=(a,t)=>ct(t,R("metadata"),a[3]),p=(a,t,e,o)=>{for(var s=0,r=a[t>>1],h=r&&r.length;s<h;s++)t&1?r[s].call(e):o=r[s].call(e,o);return o},w=(a,t,e,o,s,r)=>{var h,d,x,f,T,i=t&7,$=!!(t&8),u=!!(t&16),P=i>3?a.length+1:i?$?1:2:0,E=q[i+5],D=i>3&&(a[P-1]=[]),X=a[P]||(a[P]=[]),l=i&&(!u&&!$&&(s=s.prototype),i<5&&(i>3||!u)&&ot(i<4?s:{get[e](){return H(this,r)},set[e](c){return L(this,r,c)}},e));i?u&&i<4&&F(r,(i>2?"set ":i>1?"get ":"")+e):F(s,e);for(var b=o.length-1;b>=0;b--)f=lt(i,e,x={},a[3],X),i&&(f.static=$,f.private=u,T=f.access={has:u?c=>ht(s,c):c=>e in c},i^3&&(T.get=u?c=>(i^1?H:ut)(c,s,i^4?r:l.get):c=>c[e]),i>2&&(T.set=u?(c,k)=>L(c,s,k,i^4?r:l.set):(c,k)=>c[e]=k)),d=(0,o[b])(i?i<4?u?r:l[E]:i>4?void 0:{get:l.get,set:l.set}:s,f),x._=1,i^4||d===void 0?m(d)&&(i>4?D.unshift(d):i?u?r=d:l[E]=d:s=d):typeof d!="object"||d===null?v("Object expected"):(m(h=d.get)&&(l.get=h),m(h=d.set)&&(l.set=h),m(h=d.init)&&D.unshift(h));return i||pt(a,s),l&&I(s,e,l),u?i^4?r:l:s},O=(a,t,e)=>t.has(a)||v("Cannot "+e),ht=(a,t)=>Object(t)!==t?v('Cannot use the "in" operator on this value'):a.has(t),H=(a,t,e)=>(O(a,t,"read from private field"),e?e.call(a):t.get(a)),y=(a,t,e)=>t.has(a)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,e),L=(a,t,e,o)=>(O(a,t,"write to private field"),o?o.call(a,e):t.set(a,e),e),ut=(a,t,e)=>(O(a,t,"access private method"),e),G,B,J,K,Q,S,V,n,z,A,M,U,W;V=[st("user-ui-activities")];class g extends(S=N,Q=[C()],K=[C()],J=[C()],B=[C()],G=[C()],S){constructor(){super(...arguments),y(this,z,p(n,8,this,[])),p(n,11,this),y(this,A,p(n,12,this,new Map)),p(n,15,this),y(this,M,p(n,16,this,!1)),p(n,19,this),y(this,U,p(n,20,this,1)),p(n,23,this),y(this,W,p(n,24,this,0)),p(n,27,this),this.pageCursors=[void 0],this.pageSize=4}render(){return _`
|
|
2
2
|
<div class="page-header">
|
|
3
3
|
<h1 class="h4 fw-semibold mb-0 text-body">Activities</h1>
|
|
4
4
|
</div>
|
package/dist/web/frontend/assets/{addIdentityProvider-D91uvfNz.js → addIdentityProvider-gTMI7Z0x.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as G,s as P,O as H,d as L,c as N,a as J,
|
|
1
|
+
import{r as G,s as P,O as H,d as L,c as N,a as J,u as K,o as Q,b as R,v as B,i as V,t as X}from"./index-BT9e9Q96.js";var Y=Object.create,b=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,D=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},j=(e,t,a)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,M=(e,t)=>b(e,"name",{value:t,configurable:!0}),ee=e=>[,,,Y(e?.[D("metadata")]??null)],F=["class","method","getter","setter","accessor","field","value","get","set"],u=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,te=(e,t,a,n,i)=>({kind:F[e],name:t,metadata:n,addInitializer:s=>a._?_("Already initialized"):i.push(u(s||null))}),ae=(e,t)=>j(t,D("metadata"),e[3]),O=(e,t,a,n)=>{for(var i=0,s=e[t>>1],p=s&&s.length;i<p;i++)t&1?s[i].call(a):n=s[i].call(a,n);return n},T=(e,t,a,n,i,s)=>{var p,o,U,h,g,r=t&7,w=!!(t&8),l=!!(t&16),m=r>3?e.length+1:r?w?1:2:0,A=F[r+5],z=r>3&&(e[m-1]=[]),q=e[m]||(e[m]=[]),c=r&&(!l&&!w&&(i=i.prototype),r<5&&(r>3||!l)&&Z(r<4?i:{get[a](){return x(this,s)},set[a](d){return E(this,s,d)}},a));r?l&&r<4&&M(s,(r>2?"set ":r>1?"get ":"")+a):M(i,a);for(var y=n.length-1;y>=0;y--)h=te(r,a,U={},e[3],q),r&&(h.static=w,h.private=l,g=h.access={has:l?d=>re(i,d):d=>a in d},r^3&&(g.get=l?d=>(r^1?x:se)(d,i,r^4?s:c.get):d=>d[a]),r>2&&(g.set=l?(d,k)=>E(d,i,k,r^4?s:c.set):(d,k)=>d[a]=k)),o=(0,n[y])(r?r<4?l?s:c[A]:r>4?void 0:{get:c.get,set:c.set}:i,h),U._=1,r^4||o===void 0?u(o)&&(r>4?z.unshift(o):r?l?s=o:c[A]=o:i=o):typeof o!="object"||o===null?_("Object expected"):(u(p=o.get)&&(c.get=p),u(p=o.set)&&(c.set=p),u(p=o.init)&&z.unshift(p));return r||ae(e,i),c&&b(i,a,c),l?r^4?s:c:i},C=(e,t,a)=>t.has(e)||_("Cannot "+a),re=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),x=(e,t,a)=>(C(e,t,"read from private field"),a?a.call(e):t.get(e)),ie=(e,t,a)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),E=(e,t,a,n)=>(C(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a),se=(e,t,a)=>(C(e,t,"access private method"),a),W,S,$,v,I;$=[X("user-ui-add-idp")];class f extends(S=B,W=[G()],S){constructor(){super(...arguments),ie(this,I,O(v,8,this,!1)),O(v,11,this)}navigateBack(){P(H("/identity-providers"))}async onSave(t){this.loading=!0;try{const a=await L();await(await N(await J.accessToken.get(a))).request({method:"addIdp",params:{idp:t.idp}}),P(K("/identity-providers/"))}catch(a){this.loading=!1,Q(a)}}render(){return R`
|
|
2
2
|
<div class="page-header">
|
|
3
3
|
<h1 class="h4 fw-semibold mb-0">Add a new identity provider</h1>
|
|
4
4
|
<wg-back-link @click=${this.navigateBack}></wg-back-link>
|