@boxyhq/saml-jackson 0.4.2 → 0.5.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.
@@ -1,8 +1,8 @@
1
- import { IAdminController, Storable, OAuth } from '../typings';
1
+ import { IAdminController, Storable } from '../typings';
2
2
  export declare class AdminController implements IAdminController {
3
3
  configStore: Storable;
4
4
  constructor({ configStore }: {
5
5
  configStore: any;
6
6
  });
7
- getAllConfig(): Promise<Partial<OAuth>[]>;
7
+ getAllConfig(pageOffset?: number, pageLimit?: number): Promise<Partial<any>[]>;
8
8
  }
@@ -14,9 +14,9 @@ class AdminController {
14
14
  constructor({ configStore }) {
15
15
  this.configStore = configStore;
16
16
  }
17
- getAllConfig() {
17
+ getAllConfig(pageOffset, pageLimit) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const configList = (yield this.configStore.getAll());
19
+ const configList = (yield this.configStore.getAll(pageOffset, pageLimit));
20
20
  if (!configList || !configList.length) {
21
21
  return [];
22
22
  }
@@ -1,4 +1,4 @@
1
- import { IAPIController, IdPConfig, OAuth } from '../typings';
1
+ import { IAPIController, IdPConfig } from '../typings';
2
2
  export declare class APIController implements IAPIController {
3
3
  private configStore;
4
4
  constructor({ configStore }: {
@@ -59,23 +59,37 @@ export declare class APIController implements IAPIController {
59
59
  * description: Success
60
60
  * schema:
61
61
  * type: object
62
- * properties:
63
- * client_id:
64
- * type: string
65
- * client_secret:
66
- * type: string
67
- * provider:
68
- * type: string
69
62
  * example:
70
- * client_id: 8958e13053832b5af58fdf2ee83f35f5d013dc74
71
- * client_secret: 13f01f4df5b01770c616e682d14d3ba23f20948cfa89b1d7
72
- * type: accounts.google.com
63
+ * {
64
+ * "idpMetadata": {
65
+ * "sso": {
66
+ * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
67
+ * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
68
+ * },
69
+ * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
70
+ * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
71
+ * "loginType": "idp",
72
+ * "provider": "okta.com"
73
+ * },
74
+ * "defaultRedirectUrl": "https://hoppscotch.io/",
75
+ * "redirectUrl": ["https://hoppscotch.io/"],
76
+ * "tenant": "hoppscotch.io",
77
+ * "product": "API Engine",
78
+ * "name": "Hoppscotch-SP",
79
+ * "description": "SP for hoppscotch.io",
80
+ * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
81
+ * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
82
+ * "certs": {
83
+ * "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
84
+ * "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
85
+ * }
86
+ * }
73
87
  * 400:
74
88
  * description: Please provide rawMetadata or encodedRawMetadata | Please provide a defaultRedirectUrl | Please provide redirectUrl | Please provide tenant | Please provide product | Please provide a friendly name | Description should not exceed 100 characters
75
89
  * 401:
76
90
  * description: Unauthorized
77
91
  */
78
- config(body: IdPConfig): Promise<OAuth>;
92
+ config(body: IdPConfig): Promise<any>;
79
93
  /**
80
94
  * @swagger
81
95
  *
@@ -172,31 +186,29 @@ export declare class APIController implements IAPIController {
172
186
  * type: object
173
187
  * example:
174
188
  * {
175
- * "config": {
176
- * "idpMetadata": {
177
- * "sso": {
178
- * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
179
- * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
180
- * },
181
- * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
182
- * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
183
- * "loginType": "idp",
184
- * "provider": "okta.com"
189
+ * "idpMetadata": {
190
+ * "sso": {
191
+ * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
192
+ * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
185
193
  * },
186
- * "defaultRedirectUrl": "https://hoppscotch.io/",
187
- * "redirectUrl": ["https://hoppscotch.io/"],
188
- * "tenant": "hoppscotch.io",
189
- * "product": "API Engine",
190
- * "name": "Hoppscotch-SP",
191
- * "description": "SP for hoppscotch.io",
192
- * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
193
- * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
194
- * "certs": {
195
- * "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
196
- * "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
197
- * }
194
+ * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
195
+ * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
196
+ * "loginType": "idp",
197
+ * "provider": "okta.com"
198
+ * },
199
+ * "defaultRedirectUrl": "https://hoppscotch.io/",
200
+ * "redirectUrl": ["https://hoppscotch.io/"],
201
+ * "tenant": "hoppscotch.io",
202
+ * "product": "API Engine",
203
+ * "name": "Hoppscotch-SP",
204
+ * "description": "SP for hoppscotch.io",
205
+ * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
206
+ * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
207
+ * "certs": {
208
+ * "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
209
+ * "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
198
210
  * }
199
- * }
211
+ * }
200
212
  * '400':
201
213
  * description: Please provide `clientID` or `tenant` and `product`.
202
214
  * '401':
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -129,17 +133,31 @@ class APIController {
129
133
  * description: Success
130
134
  * schema:
131
135
  * type: object
132
- * properties:
133
- * client_id:
134
- * type: string
135
- * client_secret:
136
- * type: string
137
- * provider:
138
- * type: string
139
136
  * example:
140
- * client_id: 8958e13053832b5af58fdf2ee83f35f5d013dc74
141
- * client_secret: 13f01f4df5b01770c616e682d14d3ba23f20948cfa89b1d7
142
- * type: accounts.google.com
137
+ * {
138
+ * "idpMetadata": {
139
+ * "sso": {
140
+ * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
141
+ * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
142
+ * },
143
+ * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
144
+ * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
145
+ * "loginType": "idp",
146
+ * "provider": "okta.com"
147
+ * },
148
+ * "defaultRedirectUrl": "https://hoppscotch.io/",
149
+ * "redirectUrl": ["https://hoppscotch.io/"],
150
+ * "tenant": "hoppscotch.io",
151
+ * "product": "API Engine",
152
+ * "name": "Hoppscotch-SP",
153
+ * "description": "SP for hoppscotch.io",
154
+ * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
155
+ * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
156
+ * "certs": {
157
+ * "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
158
+ * "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
159
+ * }
160
+ * }
143
161
  * 400:
144
162
  * description: Please provide rawMetadata or encodedRawMetadata | Please provide a defaultRedirectUrl | Please provide redirectUrl | Please provide tenant | Please provide product | Please provide a friendly name | Description should not exceed 100 characters
145
163
  * 401:
@@ -174,7 +192,7 @@ class APIController {
174
192
  if (!certs) {
175
193
  throw new Error('Error generating x59 certs');
176
194
  }
177
- yield this.configStore.put(clientID, {
195
+ const record = {
178
196
  idpMetadata,
179
197
  defaultRedirectUrl,
180
198
  redirectUrl: JSON.parse(redirectUrl),
@@ -185,7 +203,8 @@ class APIController {
185
203
  clientID,
186
204
  clientSecret,
187
205
  certs,
188
- }, {
206
+ };
207
+ yield this.configStore.put(clientID, record, {
189
208
  // secondary index on entityID
190
209
  name: utils_1.IndexNames.EntityID,
191
210
  value: idpMetadata.entityID,
@@ -194,11 +213,7 @@ class APIController {
194
213
  name: utils_1.IndexNames.TenantProduct,
195
214
  value: dbutils.keyFromParts(tenant, product),
196
215
  });
197
- return {
198
- client_id: clientID,
199
- client_secret: clientSecret,
200
- provider: idpMetadata.provider,
201
- };
216
+ return record;
202
217
  });
203
218
  }
204
219
  /**
@@ -268,7 +283,6 @@ class APIController {
268
283
  * description: Unauthorized
269
284
  */
270
285
  updateConfig(body) {
271
- var _a;
272
286
  return __awaiter(this, void 0, void 0, function* () {
273
287
  const { encodedRawMetadata, // could be empty
274
288
  rawMetadata, // could be empty
@@ -282,7 +296,7 @@ class APIController {
282
296
  if (description && description.length > 100) {
283
297
  throw new error_1.JacksonError('Description should not exceed 100 characters', 400);
284
298
  }
285
- const _currentConfig = (_a = (yield this.getConfig(clientInfo))) === null || _a === void 0 ? void 0 : _a.config;
299
+ const _currentConfig = yield this.getConfig(clientInfo);
286
300
  if (_currentConfig.clientSecret !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
287
301
  throw new error_1.JacksonError('clientSecret mismatch', 400);
288
302
  }
@@ -307,7 +321,8 @@ class APIController {
307
321
  throw new error_1.JacksonError('Tenant/Product config mismatch with IdP metadata', 400);
308
322
  }
309
323
  }
310
- yield this.configStore.put(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID, Object.assign(Object.assign({}, _currentConfig), { name: name ? name : _currentConfig.name, description: description ? description : _currentConfig.description, idpMetadata: newMetadata ? newMetadata : _currentConfig.idpMetadata, defaultRedirectUrl: defaultRedirectUrl ? defaultRedirectUrl : _currentConfig.defaultRedirectUrl, redirectUrl: redirectUrl ? JSON.parse(redirectUrl) : _currentConfig.redirectUrl }), {
324
+ const record = Object.assign(Object.assign({}, _currentConfig), { name: name ? name : _currentConfig.name, description: description ? description : _currentConfig.description, idpMetadata: newMetadata ? newMetadata : _currentConfig.idpMetadata, defaultRedirectUrl: defaultRedirectUrl ? defaultRedirectUrl : _currentConfig.defaultRedirectUrl, redirectUrl: redirectUrl ? JSON.parse(redirectUrl) : _currentConfig.redirectUrl });
325
+ yield this.configStore.put(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID, record, {
311
326
  // secondary index on entityID
312
327
  name: utils_1.IndexNames.EntityID,
313
328
  value: _currentConfig.idpMetadata.entityID,
@@ -347,31 +362,29 @@ class APIController {
347
362
  * type: object
348
363
  * example:
349
364
  * {
350
- * "config": {
351
- * "idpMetadata": {
352
- * "sso": {
353
- * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
354
- * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
355
- * },
356
- * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
357
- * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
358
- * "loginType": "idp",
359
- * "provider": "okta.com"
365
+ * "idpMetadata": {
366
+ * "sso": {
367
+ * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
368
+ * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
360
369
  * },
361
- * "defaultRedirectUrl": "https://hoppscotch.io/",
362
- * "redirectUrl": ["https://hoppscotch.io/"],
363
- * "tenant": "hoppscotch.io",
364
- * "product": "API Engine",
365
- * "name": "Hoppscotch-SP",
366
- * "description": "SP for hoppscotch.io",
367
- * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
368
- * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
369
- * "certs": {
370
- * "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
371
- * "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
372
- * }
370
+ * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
371
+ * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
372
+ * "loginType": "idp",
373
+ * "provider": "okta.com"
374
+ * },
375
+ * "defaultRedirectUrl": "https://hoppscotch.io/",
376
+ * "redirectUrl": ["https://hoppscotch.io/"],
377
+ * "tenant": "hoppscotch.io",
378
+ * "product": "API Engine",
379
+ * "name": "Hoppscotch-SP",
380
+ * "description": "SP for hoppscotch.io",
381
+ * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
382
+ * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
383
+ * "certs": {
384
+ * "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
385
+ * "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
373
386
  * }
374
- * }
387
+ * }
375
388
  * '400':
376
389
  * description: Please provide `clientID` or `tenant` and `product`.
377
390
  * '401':
@@ -383,7 +396,7 @@ class APIController {
383
396
  metrics.increment('getConfig');
384
397
  if (clientID) {
385
398
  const samlConfig = yield this.configStore.get(clientID);
386
- return samlConfig ? { config: samlConfig } : {};
399
+ return samlConfig || {};
387
400
  }
388
401
  if (tenant && product) {
389
402
  const samlConfigs = yield this.configStore.getByIndex({
@@ -393,7 +406,7 @@ class APIController {
393
406
  if (!samlConfigs || !samlConfigs.length) {
394
407
  return {};
395
408
  }
396
- return { config: samlConfigs[0] };
409
+ return Object.assign({}, samlConfigs[0]);
397
410
  }
398
411
  throw new error_1.JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
399
412
  });
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -141,6 +145,12 @@ class OAuthController {
141
145
  publicKey: samlConfig.certs.publicKey,
142
146
  });
143
147
  const sessionId = crypto_1.default.randomBytes(16).toString('hex');
148
+ const requestedParams = {
149
+ tenant,
150
+ product,
151
+ client_id,
152
+ state,
153
+ };
144
154
  yield this.sessionStore.put(sessionId, {
145
155
  id: samlReq.id,
146
156
  redirect_uri,
@@ -148,6 +158,7 @@ class OAuthController {
148
158
  state,
149
159
  code_challenge,
150
160
  code_challenge_method,
161
+ requested: requestedParams,
151
162
  });
152
163
  const relayState = relayStatePrefix + sessionId;
153
164
  let redirectUrl;
@@ -213,6 +224,7 @@ class OAuthController {
213
224
  profile,
214
225
  clientID: samlConfig.clientID,
215
226
  clientSecret: samlConfig.clientSecret,
227
+ requested: session === null || session === void 0 ? void 0 : session.requested,
216
228
  };
217
229
  if (session) {
218
230
  codeVal.session = session;
@@ -228,6 +240,13 @@ class OAuthController {
228
240
  params.state = session.state;
229
241
  }
230
242
  const redirectUrl = redirect.success((session && session.redirect_uri) || samlConfig.defaultRedirectUrl, params);
243
+ // delete the session
244
+ try {
245
+ yield this.sessionStore.delete(RelayState);
246
+ }
247
+ catch (_err) {
248
+ // ignore error
249
+ }
231
250
  return { redirect_url: redirectUrl };
232
251
  });
233
252
  }
@@ -333,7 +352,15 @@ class OAuthController {
333
352
  }
334
353
  // store details against a token
335
354
  const token = crypto_1.default.randomBytes(20).toString('hex');
336
- yield this.tokenStore.put(token, codeVal.profile);
355
+ const tokenVal = Object.assign(Object.assign({}, codeVal.profile), { requested: codeVal.requested });
356
+ yield this.tokenStore.put(token, tokenVal);
357
+ // delete the code
358
+ try {
359
+ yield this.codeStore.delete(code);
360
+ }
361
+ catch (_err) {
362
+ // ignore error
363
+ }
337
364
  return {
338
365
  access_token: token,
339
366
  token_type: 'bearer',
@@ -377,7 +404,7 @@ class OAuthController {
377
404
  if (!rsp || !rsp.claims) {
378
405
  throw new error_1.JacksonError('Invalid token', 403);
379
406
  }
380
- return rsp.claims;
407
+ return Object.assign(Object.assign({}, rsp.claims), { requested: rsp.requested });
381
408
  });
382
409
  }
383
410
  }
package/dist/db/db.d.ts CHANGED
@@ -4,7 +4,7 @@ declare class DB implements DatabaseDriver {
4
4
  private encryptionKey;
5
5
  constructor(db: DatabaseDriver, encryptionKey: EncryptionKey);
6
6
  get(namespace: string, key: string): Promise<unknown>;
7
- getAll(namespace: any): Promise<unknown[]>;
7
+ getAll(namespace: any, pageOffset: any, pageLimit: any): Promise<unknown[]>;
8
8
  getByIndex(namespace: string, idx: Index): Promise<unknown[]>;
9
9
  put(namespace: string, key: string, val: unknown, ttl?: number, ...indexes: Index[]): Promise<unknown>;
10
10
  delete(namespace: string, key: string): Promise<unknown>;
package/dist/db/db.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -57,9 +61,9 @@ class DB {
57
61
  return decrypt(res, this.encryptionKey);
58
62
  });
59
63
  }
60
- getAll(namespace) {
64
+ getAll(namespace, pageOffset, pageLimit) {
61
65
  return __awaiter(this, void 0, void 0, function* () {
62
- const res = (yield this.db.getAll(namespace));
66
+ const res = (yield this.db.getAll(namespace, pageOffset, pageLimit));
63
67
  const encryptionKey = this.encryptionKey;
64
68
  return res.map((r) => {
65
69
  return decrypt(r, encryptionKey);
@@ -0,0 +1,2 @@
1
+ import { JacksonOption } from '../typings';
2
+ export default function defaultDb(opts: JacksonOption): JacksonOption;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function defaultDb(opts) {
4
+ opts.db = opts.db || {};
5
+ opts.db.engine = opts.db.engine || 'sql';
6
+ opts.db.url = opts.db.url || 'postgresql://postgres:postgres@localhost:5432/postgres';
7
+ opts.db.type = opts.db.type || 'postgres'; // Only needed if DB_ENGINE is sql.
8
+ opts.db.ttl = (opts.db.ttl || 300) * 1; // TTL for the code, session and token stores (in seconds)
9
+ opts.db.cleanupLimit = (opts.db.cleanupLimit || 1000) * 1; // Limit cleanup of TTL entries to this many items at a time
10
+ return opts;
11
+ }
12
+ exports.default = defaultDb;
package/dist/db/mem.d.ts CHANGED
@@ -10,7 +10,7 @@ declare class Mem implements DatabaseDriver {
10
10
  constructor(options: DatabaseOption);
11
11
  init(): Promise<Mem>;
12
12
  get(namespace: string, key: string): Promise<any>;
13
- getAll(namespace: string): Promise<unknown[]>;
13
+ getAll(namespace: string, pageOffset: number, pageLimit: number): Promise<unknown[]>;
14
14
  getByIndex(namespace: string, idx: Index): Promise<any>;
15
15
  put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<any>;
16
16
  delete(namespace: string, key: string): Promise<any>;
package/dist/db/mem.js CHANGED
@@ -2,7 +2,11 @@
2
2
  // This is an in-memory implementation to be used with testing and prototyping only
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
6
10
  }) : (function(o, m, k, k2) {
7
11
  if (k2 === undefined) k2 = k;
8
12
  o[k2] = m[k];
@@ -66,19 +70,28 @@ class Mem {
66
70
  return null;
67
71
  });
68
72
  }
69
- getAll(namespace) {
73
+ getAll(namespace, pageOffset, pageLimit) {
70
74
  return __awaiter(this, void 0, void 0, function* () {
75
+ const offsetAndLimitValueCheck = !dbutils.isNumeric(pageOffset) && !dbutils.isNumeric(pageLimit);
76
+ let take = Number(offsetAndLimitValueCheck ? this.options.pageLimit : pageLimit);
77
+ const skip = Number(offsetAndLimitValueCheck ? 0 : pageOffset);
78
+ let count = 0;
79
+ take += skip;
71
80
  const returnValue = [];
72
81
  if (namespace) {
73
82
  for (const key in this.store) {
74
83
  if (key.startsWith(namespace)) {
75
- returnValue.push(this.store[key]);
84
+ if (count >= take) {
85
+ break;
86
+ }
87
+ if (count >= skip) {
88
+ returnValue.push(this.store[key]);
89
+ }
90
+ count++;
76
91
  }
77
92
  }
78
93
  }
79
- if (returnValue)
80
- return returnValue;
81
- return [];
94
+ return returnValue || [];
82
95
  });
83
96
  }
84
97
  getByIndex(namespace, idx) {
@@ -7,7 +7,7 @@ declare class Mongo implements DatabaseDriver {
7
7
  constructor(options: DatabaseOption);
8
8
  init(): Promise<Mongo>;
9
9
  get(namespace: string, key: string): Promise<any>;
10
- getAll(namespace: string): Promise<unknown[]>;
10
+ getAll(namespace: string, offset: number, limit: number): Promise<unknown[]>;
11
11
  getByIndex(namespace: string, idx: Index): Promise<any>;
12
12
  put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
13
13
  delete(namespace: string, key: string): Promise<any>;
package/dist/db/mongo.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -64,10 +68,12 @@ class Mongo {
64
68
  return null;
65
69
  });
66
70
  }
67
- getAll(namespace) {
71
+ getAll(namespace, offset, limit) {
68
72
  return __awaiter(this, void 0, void 0, function* () {
69
73
  const _namespaceMatch = new RegExp(`^${namespace}:.*`);
70
- const docs = yield this.collection.find({ _id: _namespaceMatch }).toArray();
74
+ const docs = yield this.collection
75
+ .find({ _id: _namespaceMatch }, { sort: { createdAt: -1 }, skip: offset, limit: limit })
76
+ .toArray();
71
77
  if (docs)
72
78
  return docs.map(({ value }) => value);
73
79
  return [];
@@ -5,7 +5,7 @@ declare class Redis implements DatabaseDriver {
5
5
  constructor(options: DatabaseOption);
6
6
  init(): Promise<Redis>;
7
7
  get(namespace: string, key: string): Promise<any>;
8
- getAll(namespace: string): Promise<unknown[]>;
8
+ getAll(namespace: string, pageOffset: number, pageLimit: number): Promise<unknown[]>;
9
9
  getByIndex(namespace: string, idx: Index): Promise<any>;
10
10
  put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
11
11
  delete(namespace: string, key: string): Promise<any>;
package/dist/db/redis.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -27,6 +31,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
27
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
28
32
  });
29
33
  };
34
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
35
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
36
+ var m = o[Symbol.asyncIterator], i;
37
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
38
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
39
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
40
+ };
30
41
  Object.defineProperty(exports, "__esModule", { value: true });
31
42
  const redis = __importStar(require("redis"));
32
43
  const dbutils = __importStar(require("./utils"));
@@ -57,29 +68,54 @@ class Redis {
57
68
  return null;
58
69
  });
59
70
  }
60
- getAll(namespace) {
71
+ getAll(namespace, pageOffset, pageLimit) {
72
+ var e_1, _a;
61
73
  return __awaiter(this, void 0, void 0, function* () {
62
- const keys = yield this.client.sendCommand(['keys', namespace + ':*']);
74
+ const offsetAndLimitValueCheck = !dbutils.isNumeric(pageOffset) && !dbutils.isNumeric(pageLimit);
75
+ let take = Number(offsetAndLimitValueCheck ? this.options.pageLimit : pageLimit);
76
+ const skip = Number(offsetAndLimitValueCheck ? 0 : pageOffset);
63
77
  const returnValue = [];
64
- for (let i = 0; i < keys.length; i++) {
65
- try {
66
- if (this.client.get(keys[i])) {
67
- const value = yield this.client.get(keys[i]);
68
- returnValue.push(JSON.parse(value));
78
+ const keyArray = [];
79
+ let count = 0;
80
+ take += skip;
81
+ try {
82
+ for (var _b = __asyncValues(this.client.scanIterator({
83
+ MATCH: dbutils.keyFromParts(namespace, '*'),
84
+ COUNT: Math.min(take, 1000),
85
+ })), _c; _c = yield _b.next(), !_c.done;) {
86
+ const key = _c.value;
87
+ if (count >= take) {
88
+ break;
69
89
  }
90
+ if (count >= skip) {
91
+ keyArray.push(key);
92
+ }
93
+ count++;
70
94
  }
71
- catch (error) {
72
- console.error(error);
95
+ }
96
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
97
+ finally {
98
+ try {
99
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
100
+ }
101
+ finally { if (e_1) throw e_1.error; }
102
+ }
103
+ if (keyArray.length > 0) {
104
+ const value = yield this.client.MGET(keyArray);
105
+ for (let i = 0; i < value.length; i++) {
106
+ const valueObject = JSON.parse(value[i].toString());
107
+ if (valueObject !== null && valueObject !== '') {
108
+ returnValue.push(valueObject);
109
+ }
73
110
  }
74
111
  }
75
- if (returnValue)
76
- return returnValue;
77
- return [];
112
+ return returnValue || [];
78
113
  });
79
114
  }
80
115
  getByIndex(namespace, idx) {
81
116
  return __awaiter(this, void 0, void 0, function* () {
82
- const dbKeys = yield this.client.sMembers(dbutils.keyForIndex(namespace, idx));
117
+ const idxKey = dbutils.keyForIndex(namespace, idx);
118
+ const dbKeys = yield this.client.sMembers(dbutils.keyFromParts(dbutils.indexPrefix, idxKey));
83
119
  const ret = [];
84
120
  for (const dbKey of dbKeys || []) {
85
121
  ret.push(yield this.get(namespace, dbKey));
@@ -98,7 +134,7 @@ class Redis {
98
134
  // no ttl support for secondary indexes
99
135
  for (const idx of indexes || []) {
100
136
  const idxKey = dbutils.keyForIndex(namespace, idx);
101
- tx = tx.sAdd(idxKey, key);
137
+ tx = tx.sAdd(dbutils.keyFromParts(dbutils.indexPrefix, idxKey), key);
102
138
  tx = tx.sAdd(dbutils.keyFromParts(dbutils.indexPrefix, k), idxKey);
103
139
  }
104
140
  yield tx.exec();
@@ -113,7 +149,7 @@ class Redis {
113
149
  // delete secondary indexes and then the mapping of the seconary indexes
114
150
  const dbKeys = yield this.client.sMembers(idxKey);
115
151
  for (const dbKey of dbKeys || []) {
116
- tx.sRem(dbKey, key);
152
+ tx.sRem(dbutils.keyFromParts(dbutils.indexPrefix, dbKey), key);
117
153
  }
118
154
  tx.del(idxKey);
119
155
  return yield tx.exec();
@@ -10,7 +10,7 @@ declare class Sql implements DatabaseDriver {
10
10
  constructor(options: DatabaseOption);
11
11
  init(): Promise<Sql>;
12
12
  get(namespace: string, key: string): Promise<any>;
13
- getAll(namespace: string): Promise<unknown[]>;
13
+ getAll(namespace: string, pageOffset: number, pageLimit: number): Promise<unknown[]>;
14
14
  getByIndex(namespace: string, idx: Index): Promise<any>;
15
15
  put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
16
16
  delete(namespace: string, key: string): Promise<any>;
@@ -2,7 +2,11 @@
2
2
  /*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
6
10
  }) : (function(o, m, k, k2) {
7
11
  if (k2 === undefined) k2 = k;
8
12
  o[k2] = m[k];
@@ -108,8 +112,9 @@ class Sql {
108
112
  return null;
109
113
  });
110
114
  }
111
- getAll(namespace) {
115
+ getAll(namespace, pageOffset, pageLimit) {
112
116
  return __awaiter(this, void 0, void 0, function* () {
117
+ const offsetAndLimitValueCheck = !dbutils.isNumeric(pageOffset) && !dbutils.isNumeric(pageLimit);
113
118
  const response = yield this.storeRepository.find({
114
119
  where: { key: (0, typeorm_1.Like)(`%${namespace}%`) },
115
120
  select: ['value', 'iv', 'tag'],
@@ -117,6 +122,8 @@ class Sql {
117
122
  ['createdAt']: 'DESC',
118
123
  // ['createdAt']: 'ASC',
119
124
  },
125
+ take: offsetAndLimitValueCheck ? this.options.pageLimit : pageLimit,
126
+ skip: offsetAndLimitValueCheck ? 0 : pageOffset,
120
127
  });
121
128
  const returnValue = JSON.parse(JSON.stringify(response));
122
129
  if (returnValue)
@@ -178,8 +185,10 @@ class Sql {
178
185
  }
179
186
  delete(namespace, key) {
180
187
  return __awaiter(this, void 0, void 0, function* () {
188
+ const dbKey = dbutils.key(namespace, key);
189
+ yield this.ttlRepository.remove({ key: dbKey });
181
190
  return yield this.storeRepository.remove({
182
- key: dbutils.key(namespace, key),
191
+ key: dbKey,
183
192
  });
184
193
  });
185
194
  }
package/dist/db/store.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -40,9 +44,9 @@ class Store {
40
44
  return yield this.db.get(this.namespace, dbutils.keyDigest(key));
41
45
  });
42
46
  }
43
- getAll() {
47
+ getAll(pageOffset, pageLimit) {
44
48
  return __awaiter(this, void 0, void 0, function* () {
45
- return yield this.db.getAll(this.namespace);
49
+ return yield this.db.getAll(this.namespace, pageOffset, pageLimit);
46
50
  });
47
51
  }
48
52
  getByIndex(idx) {
@@ -4,4 +4,5 @@ export declare const keyForIndex: (namespace: string, idx: Index) => string;
4
4
  export declare const keyDigest: (k: string) => string;
5
5
  export declare const keyFromParts: (...parts: string[]) => string;
6
6
  export declare const sleep: (ms: number) => Promise<void>;
7
+ export declare function isNumeric(num: any): boolean;
7
8
  export declare const indexPrefix = "_index";
package/dist/db/utils.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.indexPrefix = exports.sleep = exports.keyFromParts = exports.keyDigest = exports.keyForIndex = exports.key = void 0;
6
+ exports.indexPrefix = exports.isNumeric = exports.sleep = exports.keyFromParts = exports.keyDigest = exports.keyForIndex = exports.key = void 0;
7
7
  const ripemd160_1 = __importDefault(require("ripemd160"));
8
8
  const key = (namespace, k) => {
9
9
  return namespace + ':' + k;
@@ -26,4 +26,8 @@ const sleep = (ms) => {
26
26
  return new Promise((resolve) => setTimeout(resolve, ms));
27
27
  };
28
28
  exports.sleep = sleep;
29
+ function isNumeric(num) {
30
+ return !isNaN(num);
31
+ }
32
+ exports.isNumeric = isNumeric;
29
33
  exports.indexPrefix = '_index';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -28,6 +32,7 @@ const oauth_1 = require("./controller/oauth");
28
32
  const admin_1 = require("./controller/admin");
29
33
  const db_1 = __importDefault(require("./db/db"));
30
34
  const read_config_1 = __importDefault(require("./read-config"));
35
+ const defaultDb_1 = __importDefault(require("./db/defaultDb"));
31
36
  const defaultOpts = (opts) => {
32
37
  const newOpts = Object.assign({}, opts);
33
38
  if (!newOpts.externalUrl) {
@@ -39,13 +44,9 @@ const defaultOpts = (opts) => {
39
44
  newOpts.samlAudience = newOpts.samlAudience || 'https://saml.boxyhq.com';
40
45
  newOpts.preLoadedConfig = newOpts.preLoadedConfig || ''; // path to folder containing static SAML config that will be preloaded. This is useful for self-hosted deployments that only have to support a single tenant (or small number of known tenants).
41
46
  newOpts.idpEnabled = newOpts.idpEnabled === true;
42
- newOpts.db = newOpts.db || {};
43
- newOpts.db.engine = newOpts.db.engine || 'sql';
44
- newOpts.db.url = newOpts.db.url || 'postgresql://postgres:postgres@localhost:5432/postgres';
45
- newOpts.db.type = newOpts.db.type || 'postgres'; // Only needed if DB_ENGINE is sql.
46
- newOpts.db.ttl = (newOpts.db.ttl || 300) * 1; // TTL for the code, session and token stores (in seconds)
47
- newOpts.db.cleanupLimit = (newOpts.db.cleanupLimit || 1000) * 1; // Limit cleanup of TTL entries to this many items at a time
47
+ (0, defaultDb_1.default)(newOpts);
48
48
  newOpts.clientSecretVerifier = newOpts.clientSecretVerifier || 'dummy';
49
+ newOpts.db.pageLimit = newOpts.db.pageLimit || 50;
49
50
  return newOpts;
50
51
  };
51
52
  const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/saml/saml.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/saml/x509.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/typings.d.ts CHANGED
@@ -8,14 +8,9 @@ export declare type IdPConfig = {
8
8
  rawMetadata?: string;
9
9
  encodedRawMetadata?: string;
10
10
  };
11
- export interface OAuth {
12
- client_id: string;
13
- client_secret: string;
14
- provider: string;
15
- }
16
11
  export interface IAPIController {
17
- config(body: IdPConfig): Promise<OAuth>;
18
- updateConfig(body: any): Promise<void>;
12
+ config(body: IdPConfig): Promise<any>;
13
+ updateConfig(body: any): Promise<any>;
19
14
  getConfig(body: {
20
15
  clientID?: string;
21
16
  tenant?: string;
@@ -40,7 +35,7 @@ export interface IOAuthController {
40
35
  userInfo(token: string): Promise<Profile>;
41
36
  }
42
37
  export interface IAdminController {
43
- getAllConfig(): any;
38
+ getAllConfig(pageOffset?: number, pageLimit?: number): any;
44
39
  }
45
40
  export interface OAuthReqBody {
46
41
  response_type: 'code';
@@ -80,14 +75,14 @@ export interface Index {
80
75
  value: string;
81
76
  }
82
77
  export interface DatabaseDriver {
83
- getAll(namespace: string): Promise<unknown[]>;
78
+ getAll(namespace: string, pageOffset?: number, pageLimit?: number): Promise<unknown[]>;
84
79
  get(namespace: string, key: string): Promise<any>;
85
80
  put(namespace: string, key: string, val: any, ttl: number, ...indexes: Index[]): Promise<any>;
86
81
  delete(namespace: string, key: string): Promise<any>;
87
82
  getByIndex(namespace: string, idx: Index): Promise<any>;
88
83
  }
89
84
  export interface Storable {
90
- getAll(): Promise<unknown[]>;
85
+ getAll(pageOffset?: number, pageLimit?: number): Promise<unknown[]>;
91
86
  get(key: string): Promise<any>;
92
87
  put(key: string, val: any, ...indexes: Index[]): Promise<any>;
93
88
  delete(key: string): Promise<any>;
@@ -108,6 +103,7 @@ export interface DatabaseOption {
108
103
  ttl?: number;
109
104
  cleanupLimit?: number;
110
105
  encryptionKey?: string;
106
+ pageLimit?: number;
111
107
  }
112
108
  export interface SAMLReq {
113
109
  ssoUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "SAML Jackson library",
5
5
  "keywords": [
6
6
  "SAML 2.0"
@@ -38,38 +38,38 @@
38
38
  "dependencies": {
39
39
  "@boxyhq/saml20": "0.2.0",
40
40
  "@opentelemetry/api-metrics": "0.27.0",
41
- "@peculiar/webcrypto": "1.2.3",
41
+ "@peculiar/webcrypto": "1.3.2",
42
42
  "@peculiar/x509": "1.6.1",
43
- "mongodb": "4.3.1",
43
+ "mongodb": "4.4.1",
44
44
  "mysql2": "2.3.3",
45
45
  "pg": "8.7.3",
46
- "rambda": "7.0.2",
47
- "redis": "4.0.3",
46
+ "rambda": "7.0.3",
47
+ "redis": "4.0.4",
48
48
  "reflect-metadata": "0.1.13",
49
49
  "ripemd160": "2.0.2",
50
50
  "thumbprint": "0.0.1",
51
- "typeorm": "0.2.41",
51
+ "typeorm": "0.2.45",
52
52
  "xml-crypto": "2.1.3",
53
53
  "xml2js": "0.4.23",
54
54
  "xmlbuilder": "15.1.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@types/node": "17.0.17",
57
+ "@types/node": "17.0.21",
58
58
  "@types/sinon": "10.0.11",
59
- "@types/tap": "15.0.5",
60
- "@typescript-eslint/eslint-plugin": "5.11.0",
61
- "@typescript-eslint/parser": "5.11.0",
59
+ "@types/tap": "15.0.6",
60
+ "@typescript-eslint/eslint-plugin": "5.15.0",
61
+ "@typescript-eslint/parser": "5.15.0",
62
62
  "cross-env": "7.0.3",
63
- "eslint": "8.9.0",
64
- "eslint-config-prettier": "8.3.0",
65
- "prettier": "2.5.1",
63
+ "eslint": "8.11.0",
64
+ "eslint-config-prettier": "8.5.0",
65
+ "prettier": "2.6.0",
66
66
  "sinon": "13.0.1",
67
- "tap": "15.1.6",
68
- "ts-node": "10.5.0",
69
- "tsconfig-paths": "3.12.0",
70
- "typescript": "4.5.5"
67
+ "tap": "16.0.0",
68
+ "ts-node": "10.7.0",
69
+ "tsconfig-paths": "3.14.0",
70
+ "typescript": "4.6.2"
71
71
  },
72
72
  "engines": {
73
- "node": ">=14.x"
73
+ "node": ">=14.18.1 <=16.x"
74
74
  }
75
75
  }