@mojaloop/sdk-scheme-adapter 24.9.8-snapshot.7 → 24.10.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/.circleci/config.yml +1 -1
- package/.grype.yaml +15 -0
- package/.nvmrc +1 -1
- package/.yarn/cache/{@babel-helpers-npm-7.26.9-629d8a6154-06363f8288.zip → @babel-helpers-npm-7.26.10-4eb1d94ec4-daa3689024.zip} +0 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +7 -0
- package/audit-ci.jsonc +0 -2
- package/modules/api-svc/package.json +1 -2
- package/modules/api-svc/src/InboundServer/index.js +11 -0
- package/modules/api-svc/src/index.js +6 -66
- package/modules/api-svc/test/unit/InboundServer.test.js +54 -0
- package/modules/outbound-command-event-handler/package.json +1 -1
- package/modules/outbound-domain-event-handler/package.json +1 -1
- package/modules/private-shared-lib/package.json +1 -1
- package/package.json +2 -1
package/.circleci/config.yml
CHANGED
package/.grype.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ignore:
|
|
2
|
+
- vulnerability: CVE-2025-3277 # sqlite-libs 3.48.0-r2
|
|
3
|
+
- vulnerability: CVE-2024-9410 # ada-libs 2.9.2-r1
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Set output format defaults
|
|
7
|
+
output:
|
|
8
|
+
- "table"
|
|
9
|
+
- "json"
|
|
10
|
+
|
|
11
|
+
# Modify your CircleCI job to check critical count
|
|
12
|
+
search:
|
|
13
|
+
scope: "squashed"
|
|
14
|
+
quiet: false
|
|
15
|
+
check-for-app-update: false
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
22.15.1
|
|
Binary file
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
# Changelog: [mojaloop/sdk-scheme-adapter](https://github.com/mojaloop/sdk-scheme-adapter)
|
|
2
|
+
## [24.10.0](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.9.7...v24.10.0) (2025-06-05)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* bump up the node version to v22.15.1 ([#586](https://github.com/mojaloop/sdk-scheme-adapter/issues/586)) ([2c09d28](https://github.com/mojaloop/sdk-scheme-adapter/commit/2c09d28363d065c826899b5613c148dc8d0dd0b4))
|
|
8
|
+
|
|
2
9
|
### [24.9.7](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.9.6...v24.9.7) (2025-06-02)
|
|
3
10
|
|
|
4
11
|
|
package/audit-ci.jsonc
CHANGED
|
@@ -4,7 +4,5 @@
|
|
|
4
4
|
// Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
|
|
5
5
|
"moderate": true,
|
|
6
6
|
"allowlist": [
|
|
7
|
-
"GHSA-968p-4wvh-cqc8", // https://github.com/advisories/GHSA-968p-4wvh-cqc8
|
|
8
|
-
"GHSA-jr5f-v2jv-69x6" // https://github.com/advisories/GHSA-jr5f-v2jv-69x6
|
|
9
7
|
]
|
|
10
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-api-svc",
|
|
3
|
-
"version": "21.0.0-snapshot.
|
|
3
|
+
"version": "21.0.0-snapshot.37",
|
|
4
4
|
"description": "An adapter for connecting to Mojaloop API enabled switches.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"javascript-state-machine": "3.1.0",
|
|
87
87
|
"js-yaml": "4.1.0",
|
|
88
88
|
"json-schema-ref-parser": "9.0.9",
|
|
89
|
-
"knex": "3.1.0",
|
|
90
89
|
"koa": "3.0.0",
|
|
91
90
|
"koa-body": "6.0.1",
|
|
92
91
|
"lodash": "4.17.21",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
******/
|
|
27
27
|
const Koa = require('koa');
|
|
28
28
|
|
|
29
|
+
const _ = require('lodash');
|
|
29
30
|
const assert = require('assert').strict;
|
|
30
31
|
const https = require('https');
|
|
31
32
|
const http = require('http');
|
|
@@ -86,6 +87,16 @@ class InboundApi extends EventEmitter {
|
|
|
86
87
|
return this._api.callback();
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
_updatePeerJwsKeys(peerJwsKeys) {
|
|
91
|
+
if (this._conf.pm4mlEnabled && !_.isEqual(this._jwsVerificationKeys, peerJwsKeys) &&
|
|
92
|
+
this._jwsVerificationKeys && typeof this._jwsVerificationKeys === 'object') {
|
|
93
|
+
this._logger && this._logger.isVerboseEnabled && this._logger.verbose('Clearing existing JWS verification keys');
|
|
94
|
+
Object.keys(this._jwsVerificationKeys).forEach(key => delete this._jwsVerificationKeys[key]);
|
|
95
|
+
this._logger && this._logger.isVerboseEnabled && this._logger.verbose('Assigning new peer JWS keys');
|
|
96
|
+
Object.assign(this._jwsVerificationKeys, peerJwsKeys);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
89
100
|
_startJwsWatcher() {
|
|
90
101
|
const FS_EVENT_TYPES = {
|
|
91
102
|
CHANGE: 'change',
|
|
@@ -140,60 +140,8 @@ class Server extends EventEmitter {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
_shouldUpdateInboundServer(newConf) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const isPeerJWSKeysDifferent = !_.isEqual(this.conf.peerJWSKeys, newConf.peerJWSKeys);
|
|
146
|
-
const isJwsSigningKeyDifferent = !_.isEqual(this.conf.jwsSigningKey, newConf.jwsSigningKey);
|
|
147
|
-
|
|
148
|
-
if (isInboundDifferent) {
|
|
149
|
-
this.logger.debug('Inbound config is different', {
|
|
150
|
-
oldInbound: this.conf.inbound,
|
|
151
|
-
newInbound: newConf.inbound
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (isOutboundDifferent) {
|
|
155
|
-
this.logger.debug('Outbound config is different (checked in inbound update)', {
|
|
156
|
-
oldOutbound: this.conf.outbound,
|
|
157
|
-
newOutbound: newConf.outbound
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (isPeerJWSKeysDifferent) {
|
|
162
|
-
this.logger.debug('Peer JWS Keys config is different', {
|
|
163
|
-
oldPeerJWSKeys: this.conf.peerJWSKeys,
|
|
164
|
-
newPeerJWSKeys: newConf.peerJWSKeys
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (isJwsSigningKeyDifferent) {
|
|
169
|
-
this.logger.debug('JWS Signing Key config is different', {
|
|
170
|
-
oldJwsSigningKey: this.conf.jwsSigningKey,
|
|
171
|
-
newJwsSigningKey: newConf.jwsSigningKey
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return isInboundDifferent || isOutboundDifferent || isPeerJWSKeysDifferent || isJwsSigningKeyDifferent;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
_shouldUpdateOutboundServer(newConf) {
|
|
179
|
-
const isOutboundDifferent = !_.isEqual(this.conf.outbound, newConf.outbound);
|
|
180
|
-
const isJwsSigningKeyDifferent = !_.isEqual(this.conf.jwsSigningKey, newConf.jwsSigningKey);
|
|
181
|
-
|
|
182
|
-
if (isOutboundDifferent) {
|
|
183
|
-
this.logger.debug('Outbound config is different', {
|
|
184
|
-
oldOutbound: this.conf.outbound,
|
|
185
|
-
newOutbound: newConf.outbound
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (isJwsSigningKeyDifferent) {
|
|
190
|
-
this.logger.debug('JWS Signing Key config is different', {
|
|
191
|
-
oldJwsSigningKey: this.conf.jwsSigningKey,
|
|
192
|
-
newJwsSigningKey: newConf.jwsSigningKey
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return isOutboundDifferent || isJwsSigningKeyDifferent;
|
|
143
|
+
return !_.isEqual(this.conf.inbound, newConf.inbound)
|
|
144
|
+
|| !_.isEqual(this.conf.outbound, newConf.outbound);
|
|
197
145
|
}
|
|
198
146
|
|
|
199
147
|
async start() {
|
|
@@ -281,11 +229,8 @@ class Server extends EventEmitter {
|
|
|
281
229
|
}
|
|
282
230
|
|
|
283
231
|
this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.inbound, newConf: newConf.inbound }).debug('Inbound server configuration');
|
|
284
|
-
const updateInboundServer = this._shouldUpdateInboundServer(newConf);
|
|
232
|
+
const updateInboundServer = this._shouldUpdateInboundServer(this.conf, newConf);
|
|
285
233
|
if (updateInboundServer) {
|
|
286
|
-
const stopStartLabel = 'InboundServer stop/start duration';
|
|
287
|
-
// eslint-disable-next-line no-console
|
|
288
|
-
console.time(stopStartLabel);
|
|
289
234
|
await this.inboundServer.stop();
|
|
290
235
|
this.inboundServer = new InboundServer(
|
|
291
236
|
newConf,
|
|
@@ -299,17 +244,14 @@ class Server extends EventEmitter {
|
|
|
299
244
|
this.emit('error', errMessage);
|
|
300
245
|
});
|
|
301
246
|
await this.inboundServer.start();
|
|
302
|
-
// eslint-disable-next-line no-console
|
|
303
|
-
console.timeEnd(stopStartLabel);
|
|
304
247
|
restartActionsTaken.updateInboundServer = true;
|
|
305
248
|
}
|
|
306
249
|
|
|
250
|
+
this.inboundServer._api._updatePeerJwsKeys(newConf.peerJWSKeys);
|
|
251
|
+
|
|
307
252
|
this.logger.isDebugEnabled && this.logger.push({ oldConf: this.conf.outbound, newConf: newConf.outbound }).debug('Outbound server configuration');
|
|
308
|
-
const updateOutboundServer = this.
|
|
253
|
+
const updateOutboundServer = !_.isEqual(this.conf.outbound, newConf.outbound);
|
|
309
254
|
if (updateOutboundServer) {
|
|
310
|
-
const stopStartLabel = 'OutboundServer stop/start duration';
|
|
311
|
-
// eslint-disable-next-line no-console
|
|
312
|
-
console.time(stopStartLabel);
|
|
313
255
|
await this.outboundServer.stop();
|
|
314
256
|
this.outboundServer = new OutboundServer(
|
|
315
257
|
newConf,
|
|
@@ -324,8 +266,6 @@ class Server extends EventEmitter {
|
|
|
324
266
|
this.emit('error', errMessage);
|
|
325
267
|
});
|
|
326
268
|
await this.outboundServer.start();
|
|
327
|
-
// eslint-disable-next-line no-console
|
|
328
|
-
console.timeEnd(stopStartLabel);
|
|
329
269
|
restartActionsTaken.updateOutboundServer = true;
|
|
330
270
|
}
|
|
331
271
|
|
|
@@ -490,5 +490,59 @@ describe('Inbound Server', () => {
|
|
|
490
490
|
|
|
491
491
|
expect(Jws.validator.__validationKeys['mock-jws'].toString()).toEqual('foo-key-updated');
|
|
492
492
|
});
|
|
493
|
+
|
|
494
|
+
it('should overwrite an existing peer JWS key when _updatePeerJwsKeys is called with the same key name', async () => {
|
|
495
|
+
// Arrange
|
|
496
|
+
const serverConfig = JSON.parse(JSON.stringify(defaultConfig));
|
|
497
|
+
serverConfig.validateInboundJws = true;
|
|
498
|
+
const cache = new Cache({
|
|
499
|
+
cacheUrl: serverConfig.cacheUrl,
|
|
500
|
+
logger: logger.push({ component: 'cache' }),
|
|
501
|
+
unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs,
|
|
502
|
+
});
|
|
503
|
+
serverConfig.validateInboundJws = true;
|
|
504
|
+
serverConfig.pm4mlEnabled = true;
|
|
505
|
+
serverConfig.peerJWSKeys = {
|
|
506
|
+
'peer1': 'original-key'
|
|
507
|
+
};
|
|
508
|
+
const svr = new InboundServer(serverConfig, logger, cache);
|
|
509
|
+
|
|
510
|
+
// Save reference before update
|
|
511
|
+
const keysRef = svr._api._jwsVerificationKeys;
|
|
512
|
+
|
|
513
|
+
// Act: Overwrite the key
|
|
514
|
+
svr._api._updatePeerJwsKeys({ 'peer1': 'new-key' });
|
|
515
|
+
|
|
516
|
+
// Assert
|
|
517
|
+
expect(svr._api._jwsVerificationKeys['peer1']).toBe('new-key');
|
|
518
|
+
expect(svr._api._jwsVerificationKeys).toBe(keysRef); // memory reference unchanged
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
it('should add a new peer JWS key when _updatePeerJwsKeys is called with a new key name', async () => {
|
|
522
|
+
// Arrange
|
|
523
|
+
const serverConfig = JSON.parse(JSON.stringify(defaultConfig));
|
|
524
|
+
serverConfig.validateInboundJws = true;
|
|
525
|
+
const cache = new Cache({
|
|
526
|
+
cacheUrl: serverConfig.cacheUrl,
|
|
527
|
+
logger: logger.push({ component: 'cache' }),
|
|
528
|
+
unsubscribeTimeoutMs: serverConfig.unsubscribeTimeoutMs,
|
|
529
|
+
});
|
|
530
|
+
serverConfig.validateInboundJws = true;
|
|
531
|
+
serverConfig.pm4mlEnabled = true;
|
|
532
|
+
serverConfig.peerJWSKeys = {
|
|
533
|
+
'peer1': 'original-key'
|
|
534
|
+
};
|
|
535
|
+
const svr = new InboundServer(serverConfig, logger, cache);
|
|
536
|
+
|
|
537
|
+
// Save reference before update
|
|
538
|
+
const keysRef = svr._api._jwsVerificationKeys;
|
|
539
|
+
|
|
540
|
+
// Act: Add a new key
|
|
541
|
+
svr._api._updatePeerJwsKeys({ 'peer1': 'original-key', 'peer2': 'another-key' });
|
|
542
|
+
// Assert
|
|
543
|
+
expect(svr._api._jwsVerificationKeys['peer1']).toBe('original-key');
|
|
544
|
+
expect(svr._api._jwsVerificationKeys['peer2']).toBe('another-key');
|
|
545
|
+
expect(svr._api._jwsVerificationKeys).toBe(keysRef); // memory reference unchanged
|
|
546
|
+
});
|
|
493
547
|
});
|
|
494
548
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.34",
|
|
4
4
|
"description": "Mojaloop sdk scheme adapter command event handler",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.34",
|
|
4
4
|
"description": "mojaloop sdk scheme adapter outbound domain event handler",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
|
|
3
|
-
"version": "0.4.0-snapshot.
|
|
3
|
+
"version": "0.4.0-snapshot.34",
|
|
4
4
|
"description": "SDK Scheme Adapter private shared library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.10.0",
|
|
4
4
|
"description": "mojaloop sdk-scheme-adapter",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"eslint-plugin-import": "2.31.0",
|
|
93
93
|
"husky": "9.1.7",
|
|
94
94
|
"jest": "29.7.0",
|
|
95
|
+
"knex": "3.1.0",
|
|
95
96
|
"nodemon": "3.1.10",
|
|
96
97
|
"npm-check-updates": "16.7.10",
|
|
97
98
|
"replace": "1.2.2",
|