@exortek/apikey 1.0.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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Does `granted` cover a single `required` scope?
3
+ * @param {string[]} granted
4
+ * @param {string} required
5
+ * @returns {boolean}
6
+ */
7
+ export function covers(granted: string[], required: string): boolean;
8
+ /**
9
+ * All required scopes must be covered by granted.
10
+ * @param {string[]} granted
11
+ * @param {string[]} required
12
+ * @returns {boolean}
13
+ */
14
+ export function hasAll(granted: string[], required: string[]): boolean;
15
+ /**
16
+ * At least one required scope must be covered.
17
+ * @param {string[]} granted
18
+ * @param {string[]} required
19
+ * @returns {boolean}
20
+ */
21
+ export function hasAny(granted: string[], required: string[]): boolean;
@@ -0,0 +1,2 @@
1
+ export { memoryStore } from "./memory.js";
2
+ export { redisStore } from "./redis.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @returns {import('../index.js').ApiKeyStore & { _size: () => number }}
3
+ */
4
+ export function memoryStore(): import("../index.js").ApiKeyStore & {
5
+ _size: () => number;
6
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @typedef {object} RedisStoreOptions
3
+ * @property {string} [keyPrefix='apikey:']
4
+ */
5
+ /**
6
+ * @param {any} client
7
+ * @param {RedisStoreOptions} [options]
8
+ * @returns {import('../index.js').ApiKeyStore}
9
+ */
10
+ export function redisStore(client: any, options?: RedisStoreOptions): import("../index.js").ApiKeyStore;
11
+ export type RedisStoreOptions = {
12
+ keyPrefix?: string | undefined;
13
+ };