@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.
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +263 -0
- package/dist/errors.d.ts +20 -0
- package/dist/index.cjs +1632 -0
- package/dist/index.d.ts +278 -0
- package/dist/index.mjs +1617 -0
- package/dist/internal/guards.d.ts +4 -0
- package/dist/middleware/core.d.ts +86 -0
- package/dist/middleware/express.cjs +1363 -0
- package/dist/middleware/express.d.ts +4 -0
- package/dist/middleware/express.mjs +1361 -0
- package/dist/middleware/fastify.cjs +1374 -0
- package/dist/middleware/fastify.d.ts +1 -0
- package/dist/middleware/fastify.mjs +1372 -0
- package/dist/scopes.d.ts +21 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/memory.d.ts +6 -0
- package/dist/stores/redis.d.ts +13 -0
- package/dist/stores.cjs +880 -0
- package/dist/stores.mjs +877 -0
- package/dist/token.d.ts +88 -0
- package/package.json +98 -0
package/dist/scopes.d.ts
ADDED
|
@@ -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,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
|
+
};
|