@verii/agentdb-cli 1.1.0-pre.1770078755 → 1.1.0-pre.1770084266

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verii/agentdb-cli",
3
- "version": "1.1.0-pre.1770078755",
3
+ "version": "1.1.0-pre.1770084266",
4
4
  "description": "A cli for working with agent database.",
5
5
  "repository": "https://github.com/LFDT-Verii/core",
6
6
  "main": "src/index.js",
@@ -9,9 +9,9 @@
9
9
  },
10
10
  "scripts": {
11
11
  "test": "cross-env NODE_ENV=test node --test --test-concurrency=1 --experimental-test-module-mocks --experimental-test-coverage **/*.test.js --passWithNoTests",
12
- "lint": "eslint --ext .js .",
12
+ "lint": "eslint .",
13
13
  "lint:ci": "eslint . --format json >> eslint-results.json",
14
- "lint:fix": "eslint --fix --ext .js ."
14
+ "lint:fix": "eslint --fix ."
15
15
  },
16
16
  "author": "Denis Smolonski",
17
17
  "license": "Apache-2.0",
@@ -19,22 +19,23 @@
19
19
  "access": "public"
20
20
  },
21
21
  "devDependencies": {
22
- "@verii/tests-helpers": "1.1.0-pre.1770078755",
23
- "eslint": "8.57.1",
24
- "eslint-config-airbnb-base": "14.2.1",
25
- "eslint-config-prettier": "8.10.2",
26
- "eslint-plugin-better-mutation": "1.7.0",
22
+ "@verii/tests-helpers": "1.1.0-pre.1770084266",
23
+ "eslint": "9.39.2",
24
+ "eslint-config-airbnb-extended": "3.0.1",
25
+ "eslint-config-prettier": "10.1.8",
26
+ "eslint-plugin-better-mutation": "2.1.0",
27
27
  "eslint-plugin-import": "2.32.0",
28
- "eslint-plugin-prettier": "4.2.5",
29
- "eslint-watch": "7.0.0",
28
+ "eslint-plugin-prettier": "5.5.5",
29
+ "eslint-watch": "8.0.0",
30
30
  "expect": "30.2.0",
31
- "prettier": "2.8.8"
31
+ "globals": "16.5.0",
32
+ "prettier": "3.8.1"
32
33
  },
33
34
  "dependencies": {
34
- "@verii/crypto": "1.1.0-pre.1770078755",
35
+ "@verii/crypto": "1.1.0-pre.1770084266",
35
36
  "commander": "~13.1.0",
36
37
  "lodash": "^4.17.21",
37
38
  "mongodb": "~6.20.0"
38
39
  },
39
- "gitHead": "779731130ac24236389c70deaeb6bc095faee2a5"
40
+ "gitHead": "53570389d95350e797d52f6bfd77d07e945f9ceb"
40
41
  }
@@ -9,19 +9,19 @@ program
9
9
  .usage('[options]')
10
10
  .requiredOption(
11
11
  '-u, --mongo-uri <mongoUri>',
12
- 'The url of the mongo database for credential agent'
12
+ 'The url of the mongo database for credential agent',
13
13
  )
14
14
  .requiredOption(
15
15
  '-s, --start <start>',
16
- 'The start date for filter (ISO 8601 Timestamp)'
16
+ 'The start date for filter (ISO 8601 Timestamp)',
17
17
  )
18
18
  .requiredOption(
19
19
  '-e, --end <end>',
20
- 'The end date for filter (ISO 8601 Timestamp)'
20
+ 'The end date for filter (ISO 8601 Timestamp)',
21
21
  )
22
22
  .requiredOption(
23
23
  '-d, --did <did>',
24
- 'The did of the tenant on credential agent'
24
+ 'The did of the tenant on credential agent',
25
25
  )
26
26
  .action(async () => {
27
27
  const options = program.opts();
@@ -34,7 +34,7 @@ program
34
34
  const end = new Date(options.end);
35
35
  const { total, unique } = await getMetrics(
36
36
  { start, end, did: options.did },
37
- { db: client.db() }
37
+ { db: client.db() },
38
38
  );
39
39
  printInfo('Metrics Script Success:');
40
40
  printInfo(`Start Date: ${start.toString()}`);
@@ -11,7 +11,7 @@ program
11
11
  .usage('[options]')
12
12
  .requiredOption(
13
13
  '-u, --mongo-uri <mongoUri>',
14
- 'The url of the mongo database for credential agent'
14
+ 'The url of the mongo database for credential agent',
15
15
  )
16
16
  .action(async () => {
17
17
  const options = program.opts();
@@ -21,7 +21,7 @@ const removePiiFromFinalizedOffers = async ({ db }) => {
21
21
  await collection.bulkWrite(updates);
22
22
  forEach(
23
23
  ({ _id }) => printInfo(`Offer with _id (${_id.toString()}) was updated`),
24
- offers
24
+ offers,
25
25
  );
26
26
  };
27
27
 
@@ -11,19 +11,19 @@ program
11
11
  .requiredOption('-n, --new-key <newKey>', 'New encryption key')
12
12
  .requiredOption(
13
13
  '-u, --mongo-uri <mongoUri>',
14
- 'The url of the mongo database for credential agent'
14
+ 'The url of the mongo database for credential agent',
15
15
  )
16
16
  .option(
17
17
  '-c, --collection <collection>',
18
- 'Override the default collection to update'
18
+ 'Override the default collection to update',
19
19
  )
20
20
  .option(
21
21
  '-p, --secret-prop <secretProp>',
22
- 'Override the default encrypted property on the collection'
22
+ 'Override the default encrypted property on the collection',
23
23
  )
24
24
  .option(
25
25
  '--dry-run',
26
- 'Attempt re-encryption but not actually update the database'
26
+ 'Attempt re-encryption but not actually update the database',
27
27
  )
28
28
  .action(async () => {
29
29
  const options = program.opts();
@@ -40,7 +40,7 @@ program
40
40
  {
41
41
  ...options,
42
42
  db: client.db(),
43
- }
43
+ },
44
44
  );
45
45
  } catch (error) {
46
46
  printError('rotate-key Script Failure');
@@ -21,7 +21,7 @@ const decryptField = ({ encryptedField, oldKey, entry }, options) => {
21
21
  return decryptCollection(encryptedField, oldKey);
22
22
  } catch (e) {
23
23
  printInfo(
24
- `Error decrypting '${options.secretProp}' field of _id: ${entry._id}`
24
+ `Error decrypting '${options.secretProp}' field of _id: ${entry._id}`,
25
25
  );
26
26
  throw e;
27
27
  }
@@ -31,7 +31,7 @@ const reencryptCollectionField = async (
31
31
  newKey,
32
32
  _collection,
33
33
  secretProp,
34
- { db, ...options }
34
+ { db, ...options },
35
35
  ) => {
36
36
  const currentTime = new Date();
37
37
 
@@ -52,9 +52,9 @@ const reencryptCollectionField = async (
52
52
  decryptField({ encryptedField, oldKey, entry }, options),
53
53
  (decryptedField) => encryptCollection(decryptedField, newKey),
54
54
  (encryptedField) =>
55
- updateProp(entry._id, secretPropKey, encryptedField, currentTime)
55
+ updateProp(entry._id, secretPropKey, encryptedField, currentTime),
56
56
  )(entry),
57
- entries
57
+ entries,
58
58
  );
59
59
  const printEntries = () => {
60
60
  each((eW) => printInfo(`${get('_id', eW)}`), entries);
@@ -65,7 +65,7 @@ const reencryptCollectionField = async (
65
65
  printInfo(
66
66
  `Dry Run: would have rotated encryption of ${size(entries)} ${
67
67
  options.collection
68
- }`
68
+ }`,
69
69
  );
70
70
  return;
71
71
  }
@@ -75,7 +75,7 @@ const reencryptCollectionField = async (
75
75
  printInfo(
76
76
  `Rotated encryption of ${size(entries)} '${secretPropKey}' fields in ${
77
77
  options.collection
78
- }`
78
+ }`,
79
79
  );
80
80
  };
81
81
 
@@ -6,7 +6,7 @@ const reencrypt = async (
6
6
  newKey,
7
7
  collection,
8
8
  secretProp,
9
- { db, ...options }
9
+ { db, ...options },
10
10
  ) => {
11
11
  await reencryptCollectionField(
12
12
  oldKey,
@@ -16,7 +16,7 @@ const reencrypt = async (
16
16
  {
17
17
  db,
18
18
  ...options,
19
- }
19
+ },
20
20
  );
21
21
 
22
22
  if (!collection && !secretProp) {
@@ -28,7 +28,7 @@ const reencrypt = async (
28
28
  {
29
29
  db,
30
30
  ...options,
31
- }
31
+ },
32
32
  );
33
33
  }
34
34
  };
@@ -13,7 +13,7 @@ describe('metrics test suite', () => {
13
13
 
14
14
  before(async () => {
15
15
  client = await initMongoClient(
16
- buildMongoConnection('test-credentialagent')
16
+ buildMongoConnection('test-credentialagent'),
17
17
  );
18
18
  db = client.db();
19
19
  persistOffer = persistOfferFactory(db);
@@ -53,10 +53,10 @@ describe('offers test suite', () => {
53
53
  },
54
54
  ]);
55
55
  expect(updatedOffers[0].updatedAt.getTime()).toBeGreaterThan(
56
- offer1.updatedAt.getTime()
56
+ offer1.updatedAt.getTime(),
57
57
  );
58
58
  expect(updatedOffers[1].updatedAt.getTime()).toBeGreaterThan(
59
- offer2.updatedAt.getTime()
59
+ offer2.updatedAt.getTime(),
60
60
  );
61
61
  });
62
62
 
@@ -91,10 +91,10 @@ describe('offers test suite', () => {
91
91
  },
92
92
  ]);
93
93
  expect(updatedOffers[0].updatedAt.getTime()).toBeGreaterThan(
94
- offer1.updatedAt.getTime()
94
+ offer1.updatedAt.getTime(),
95
95
  );
96
96
  expect(updatedOffers[1].updatedAt.getTime()).toEqual(
97
- offer2.updatedAt.getTime()
97
+ offer2.updatedAt.getTime(),
98
98
  );
99
99
  });
100
100
  });
@@ -17,7 +17,7 @@ describe('pii-purge test suite', () => {
17
17
  let persistOffer;
18
18
  before(async () => {
19
19
  client = await initMongoClient(
20
- buildMongoConnection('test-credentialagent')
20
+ buildMongoConnection('test-credentialagent'),
21
21
  );
22
22
  db = client.db();
23
23
  persistOffer = persistOfferFactory(db);
@@ -71,7 +71,7 @@ describe('rotate-key test suite', () => {
71
71
 
72
72
  before(async () => {
73
73
  client = await initMongoClient(
74
- buildMongoConnection('test-credentialagent')
74
+ buildMongoConnection('test-credentialagent'),
75
75
  );
76
76
  db = client.db();
77
77
  persistKey = persistKeyFactory(db);
@@ -99,7 +99,7 @@ describe('rotate-key test suite', () => {
99
99
  newKey,
100
100
  testOptions.collection,
101
101
  testOptions.secretProp,
102
- { db, ...testOptions }
102
+ { db, ...testOptions },
103
103
  );
104
104
  });
105
105
 
@@ -110,7 +110,7 @@ describe('rotate-key test suite', () => {
110
110
  newKey,
111
111
  testOptions.collection,
112
112
  testOptions.secretProp,
113
- { db, ...testOptions }
113
+ { db, ...testOptions },
114
114
  );
115
115
  const updatedKey = await db.collection('keys').findOne(key._id);
116
116
  expect(decryptCollection(updatedKey.key, newKey)).toEqual(decryptedKey);
@@ -127,7 +127,7 @@ describe('rotate-key test suite', () => {
127
127
  db,
128
128
  ...testOptions,
129
129
  dryRun: true,
130
- }
130
+ },
131
131
  );
132
132
  const updatedKey = await db.collection('keys').findOne(key._id);
133
133
  expect(updatedKey.key).toEqual(key.key);
@@ -145,7 +145,7 @@ describe('rotate-key test suite', () => {
145
145
  newKey,
146
146
  testOptions.collection,
147
147
  testOptions.secretProp,
148
- { db, ...testOptions }
148
+ { db, ...testOptions },
149
149
  );
150
150
 
151
151
  const updatedFoo = await db.collection('foos').findOne(foo._id);
@@ -166,12 +166,12 @@ describe('rotate-key test suite', () => {
166
166
  newKey,
167
167
  testOptions.collection,
168
168
  testOptions.secretProp,
169
- { db, ...testOptions }
169
+ { db, ...testOptions },
170
170
  );
171
171
 
172
172
  const updatedTenant = await db.collection('tenants').findOne(tenant._id);
173
173
  expect(
174
- decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey)
174
+ decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey),
175
175
  ).toEqual(decryptedTenant);
176
176
 
177
177
  expect(updatedTenant.webhookAuth).toEqual({
@@ -188,10 +188,10 @@ describe('rotate-key test suite', () => {
188
188
  newKey,
189
189
  testOptions.collection,
190
190
  testOptions.secretProp,
191
- { db, ...testOptions }
191
+ { db, ...testOptions },
192
192
  );
193
193
  await expect(exec).rejects.toThrow(
194
- 'Unsupported state or unable to authenticate data'
194
+ 'Unsupported state or unable to authenticate data',
195
195
  );
196
196
  });
197
197
 
@@ -207,7 +207,7 @@ describe('rotate-key test suite', () => {
207
207
  expect(decryptCollection(updatedKey.key, newKey)).toEqual(decryptedKey);
208
208
 
209
209
  expect(
210
- decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey)
210
+ decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey),
211
211
  ).toEqual(decryptedTenant);
212
212
 
213
213
  expect(updatedTenant.webhookAuth).toEqual({
@@ -231,7 +231,7 @@ describe('rotate-key test suite', () => {
231
231
  expect(decryptCollection(updatedKey.key, newKey)).toEqual(decryptedKey);
232
232
 
233
233
  expect(
234
- decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey)
234
+ decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey),
235
235
  ).toEqual(decryptedTenant);
236
236
 
237
237
  expect(updatedTenant.webhookAuth).toEqual({
@@ -254,7 +254,7 @@ describe('rotate-key test suite', () => {
254
254
  expect(decryptCollection(sameKey.key, oldKey)).toEqual(decryptedKey);
255
255
 
256
256
  expect(
257
- decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey)
257
+ decryptCollection(updatedTenant.webhookAuth.bearerToken, newKey),
258
258
  ).toEqual(decryptedTenant);
259
259
  });
260
260
 
@@ -271,7 +271,7 @@ describe('rotate-key test suite', () => {
271
271
 
272
272
  expect(decryptCollection(updatedKey.key, newKey)).toEqual(decryptedKey);
273
273
  expect(
274
- decryptCollection(sameTenant.webhookAuth.bearerToken, oldKey)
274
+ decryptCollection(sameTenant.webhookAuth.bearerToken, oldKey),
275
275
  ).toEqual(decryptedTenant);
276
276
  });
277
277
 
@@ -288,7 +288,7 @@ describe('rotate-key test suite', () => {
288
288
 
289
289
  expect(decryptCollection(updatedKey.key, newKey)).toEqual(decryptedKey);
290
290
  expect(
291
- decryptCollection(sameTenant.webhookAuth.bearerToken, oldKey)
291
+ decryptCollection(sameTenant.webhookAuth.bearerToken, oldKey),
292
292
  ).toEqual(decryptedTenant);
293
293
  });
294
294
  });