@@ -263,53 +263,6 @@ searchForFacets(
263
263
return this.search(searchMethodParams, requestOptions) as Promise< {results: Array< SearchForFacetValuesResponse> } >;
264
264
},
265
265
266
- /**
267
- * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
268
- *
269
- * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
270
- * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
271
- * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
272
- * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
273
- */
274
- generateSecuredApiKey({
275
- parentApiKey,
276
- restrictions = {} ,
277
- }: GenerateSecuredApiKeyOptions): string {
278
- const queryParameters = serializeQueryParameters({
279
- ...restrictions,
280
- ...restrictions.searchParams,
281
- searchParams: undefined,
282
- } );
283
- return Buffer.from(
284
- createHmac('sha256', parentApiKey)
285
- .update(queryParameters)
286
- .digest('hex') + queryParameters
287
- ).toString('base64');
288
- },
289
-
290
- /**
291
- * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
292
- *
293
- * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
294
- * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
295
- * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
296
- */
297
- getSecuredApiKeyRemainingValidity({
298
- securedApiKey,
299
- } : GetSecuredApiKeyRemainingValidityOptions): number {
300
- const decodedString = Buffer.from(securedApiKey, ' base64' ).toString(
301
- ' ascii'
302
- );
303
- const regex = /validUntil= (\d+)/;
304
- const match = decodedString.match(regex);
305
-
306
- if (match === null) {
307
- throw new Error(' validUntil not found in given secured api key.' );
308
- }
309
-
310
- return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
311
- },
312
-
313
266
/**
314
267
* Helper: Chunks the given `objects` list in subset of 1000 elements max in order to make it fit in `batch` requests.
315
268
*
0 commit comments