@hot-updater/plugin-api-keys 1.0.0-rc.20

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,39 @@
1
+ import { defineTable } from "@hot-updater/plugin-core/server-plugin";
2
+ //#region src/server/schema.ts
3
+ /** v1's `api_keys` columns; the plaintext key is never stored, only its SHA-256 digest. */
4
+ const apiKeysSchema = { api_keys: defineTable({
5
+ id: {
6
+ type: "string",
7
+ maxLength: 255
8
+ },
9
+ hash: {
10
+ type: "string",
11
+ maxLength: 64,
12
+ unique: true
13
+ },
14
+ name: {
15
+ type: "string",
16
+ maxLength: 64
17
+ },
18
+ prefix: {
19
+ type: "string",
20
+ maxLength: 16
21
+ },
22
+ role: {
23
+ type: "string",
24
+ maxLength: 16
25
+ },
26
+ created_at_ms: { type: "integer" },
27
+ revoked_at_ms: {
28
+ type: "integer",
29
+ required: false
30
+ }
31
+ }, {
32
+ key: ["id"],
33
+ indexes: { byCreated: {
34
+ eq: [],
35
+ sort: ["created_at_ms"]
36
+ } }
37
+ }) };
38
+ //#endregion
39
+ export { apiKeysSchema };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@hot-updater/plugin-api-keys",
3
+ "type": "module",
4
+ "version": "1.0.0-rc.20",
5
+ "description": "Hot Updater's API keys plugin: protects client routes with API keys and manages them",
6
+ "exports": {
7
+ "./internal": {
8
+ "import": "./dist/internal.mjs",
9
+ "require": "./dist/internal.cjs"
10
+ },
11
+ "./server": {
12
+ "import": "./dist/server/index.mjs",
13
+ "require": "./dist/server/index.cjs"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/gronxb/hot-updater"
21
+ },
22
+ "author": "gronxb <gron1gh1@gmail.com> (https://github.com/gronxb)",
23
+ "bugs": {
24
+ "url": "https://github.com/gronxb/hot-updater/issues"
25
+ },
26
+ "homepage": "https://github.com/gronxb/hot-updater#readme",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "package.json"
33
+ ],
34
+ "dependencies": {
35
+ "@hot-updater/plugin-core": "1.0.0-rc.20"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20"
39
+ },
40
+ "scripts": {
41
+ "build": "tsdown",
42
+ "test:type": "tsc --noEmit"
43
+ }
44
+ }