@lokiplay/protocol 0.1.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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +127 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Loki Play contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @lokiplay/protocol
|
|
2
|
+
|
|
3
|
+
Shared Loki schemas and TypeScript types for manifests, rooms, messages, and
|
|
4
|
+
player session claims, plus canonical JSON and state hashing utilities.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install @lokiplay/protocol
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Schemas are exported as Zod schemas with corresponding inferred TypeScript
|
|
11
|
+
types.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ProjectStateSchema: z.ZodEnum<{
|
|
3
|
+
draft: "draft";
|
|
4
|
+
private: "private";
|
|
5
|
+
unlisted: "unlisted";
|
|
6
|
+
review_requested: "review_requested";
|
|
7
|
+
published: "published";
|
|
8
|
+
suspended: "suspended";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const GameManifestSchema: z.ZodObject<{
|
|
11
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
entrypoint: z.ZodString;
|
|
14
|
+
multiplayer: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
enabled: z.ZodBoolean;
|
|
16
|
+
authority: z.ZodLiteral<"host">;
|
|
17
|
+
maxPlayers: z.ZodNumber;
|
|
18
|
+
tickRate: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
networkAllowlist: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export declare const RoomConfigSchema: z.ZodObject<{
|
|
23
|
+
roomKey: z.ZodString;
|
|
24
|
+
visibility: z.ZodEnum<{
|
|
25
|
+
private: "private";
|
|
26
|
+
unlisted: "unlisted";
|
|
27
|
+
matchmaking: "matchmaking";
|
|
28
|
+
}>;
|
|
29
|
+
maxPlayers: z.ZodNumber;
|
|
30
|
+
teamSize: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export declare const ClientEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"action">;
|
|
34
|
+
payload: z.ZodUnknown;
|
|
35
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
36
|
+
roomId: z.ZodString;
|
|
37
|
+
sequence: z.ZodNumber;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"event">;
|
|
40
|
+
payload: z.ZodUnknown;
|
|
41
|
+
reliable: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
43
|
+
roomId: z.ZodString;
|
|
44
|
+
sequence: z.ZodNumber;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"host_state">;
|
|
47
|
+
expectedVersion: z.ZodNumber;
|
|
48
|
+
state: z.ZodUnknown;
|
|
49
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
50
|
+
roomId: z.ZodString;
|
|
51
|
+
sequence: z.ZodNumber;
|
|
52
|
+
}, z.core.$strip>], "type">;
|
|
53
|
+
export declare const ServerEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"snapshot">;
|
|
55
|
+
hostId: z.ZodString;
|
|
56
|
+
state: z.ZodUnknown;
|
|
57
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
58
|
+
roomId: z.ZodString;
|
|
59
|
+
sequence: z.ZodNumber;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"state">;
|
|
62
|
+
hostId: z.ZodString;
|
|
63
|
+
state: z.ZodUnknown;
|
|
64
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
65
|
+
roomId: z.ZodString;
|
|
66
|
+
sequence: z.ZodNumber;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"error">;
|
|
69
|
+
code: z.ZodEnum<{
|
|
70
|
+
UNAUTHORIZED: "UNAUTHORIZED";
|
|
71
|
+
TENANT_MISMATCH: "TENANT_MISMATCH";
|
|
72
|
+
STALE_VERSION: "STALE_VERSION";
|
|
73
|
+
HOST_REQUIRED: "HOST_REQUIRED";
|
|
74
|
+
RATE_LIMITED: "RATE_LIMITED";
|
|
75
|
+
INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
76
|
+
}>;
|
|
77
|
+
message: z.ZodString;
|
|
78
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
79
|
+
roomId: z.ZodString;
|
|
80
|
+
sequence: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>], "type">;
|
|
82
|
+
export declare const PlayerSessionClaimsSchema: z.ZodObject<{
|
|
83
|
+
issuer: z.ZodLiteral<"lokiplay">;
|
|
84
|
+
audience: z.ZodLiteral<"lokiplay-game">;
|
|
85
|
+
subject: z.ZodString;
|
|
86
|
+
projectId: z.ZodString;
|
|
87
|
+
organizationId: z.ZodString;
|
|
88
|
+
guest: z.ZodBoolean;
|
|
89
|
+
issuedAt: z.ZodNumber;
|
|
90
|
+
expiresAt: z.ZodNumber;
|
|
91
|
+
nonce: z.ZodString;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export type ProjectState = z.infer<typeof ProjectStateSchema>;
|
|
94
|
+
export type GameManifest = z.infer<typeof GameManifestSchema>;
|
|
95
|
+
export type RoomConfig = z.infer<typeof RoomConfigSchema>;
|
|
96
|
+
export type ClientEnvelope = z.infer<typeof ClientEnvelopeSchema>;
|
|
97
|
+
export type ServerEnvelope = z.infer<typeof ServerEnvelopeSchema>;
|
|
98
|
+
export type PlayerSessionClaims = z.infer<typeof PlayerSessionClaimsSchema>;
|
|
99
|
+
export declare function canonicalJson(value: unknown): string;
|
|
100
|
+
export declare function stateHash(value: unknown): string;
|
|
101
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;EAO7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;kBAiBpB,CAAC;AAEZ,eAAO,MAAM,gBAAgB;;;;;;;;;kBAW1B,CAAC;AAQJ,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;2BAkB/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA0B/B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;kBAY3B,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBpD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const ProjectStateSchema = z.enum([
|
|
4
|
+
"draft",
|
|
5
|
+
"private",
|
|
6
|
+
"unlisted",
|
|
7
|
+
"review_requested",
|
|
8
|
+
"published",
|
|
9
|
+
"suspended",
|
|
10
|
+
]);
|
|
11
|
+
export const GameManifestSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
schemaVersion: z.literal(1),
|
|
14
|
+
name: z.string().trim().min(1).max(80),
|
|
15
|
+
entrypoint: z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9._/-]+\.html$/),
|
|
18
|
+
multiplayer: z
|
|
19
|
+
.object({
|
|
20
|
+
enabled: z.boolean(),
|
|
21
|
+
authority: z.literal("host"),
|
|
22
|
+
maxPlayers: z.number().int().min(1).max(16),
|
|
23
|
+
tickRate: z.number().int().min(1).max(10),
|
|
24
|
+
})
|
|
25
|
+
.optional(),
|
|
26
|
+
networkAllowlist: z.array(z.string().url()).max(10).default([]),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
export const RoomConfigSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
roomKey: z.string().regex(/^[a-z0-9-]{1,64}$/),
|
|
32
|
+
visibility: z.enum(["private", "unlisted", "matchmaking"]),
|
|
33
|
+
maxPlayers: z.number().int().min(1).max(16),
|
|
34
|
+
teamSize: z.number().int().min(1).max(16).optional(),
|
|
35
|
+
})
|
|
36
|
+
.strict()
|
|
37
|
+
.refine((value) => !value.teamSize || value.maxPlayers % value.teamSize === 0, "teamSize must divide maxPlayers");
|
|
38
|
+
const EnvelopeBase = {
|
|
39
|
+
protocolVersion: z.literal(1),
|
|
40
|
+
roomId: z.string().uuid(),
|
|
41
|
+
sequence: z.number().int().nonnegative(),
|
|
42
|
+
};
|
|
43
|
+
export const ClientEnvelopeSchema = z.discriminatedUnion("type", [
|
|
44
|
+
z.object({
|
|
45
|
+
...EnvelopeBase,
|
|
46
|
+
type: z.literal("action"),
|
|
47
|
+
payload: z.unknown(),
|
|
48
|
+
}),
|
|
49
|
+
z.object({
|
|
50
|
+
...EnvelopeBase,
|
|
51
|
+
type: z.literal("event"),
|
|
52
|
+
payload: z.unknown(),
|
|
53
|
+
reliable: z.boolean().default(true),
|
|
54
|
+
}),
|
|
55
|
+
z.object({
|
|
56
|
+
...EnvelopeBase,
|
|
57
|
+
type: z.literal("host_state"),
|
|
58
|
+
expectedVersion: z.number().int().nonnegative(),
|
|
59
|
+
state: z.unknown(),
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
export const ServerEnvelopeSchema = z.discriminatedUnion("type", [
|
|
63
|
+
z.object({
|
|
64
|
+
...EnvelopeBase,
|
|
65
|
+
type: z.literal("snapshot"),
|
|
66
|
+
hostId: z.string().uuid(),
|
|
67
|
+
state: z.unknown(),
|
|
68
|
+
}),
|
|
69
|
+
z.object({
|
|
70
|
+
...EnvelopeBase,
|
|
71
|
+
type: z.literal("state"),
|
|
72
|
+
hostId: z.string().uuid(),
|
|
73
|
+
state: z.unknown(),
|
|
74
|
+
}),
|
|
75
|
+
z.object({
|
|
76
|
+
...EnvelopeBase,
|
|
77
|
+
type: z.literal("error"),
|
|
78
|
+
code: z.enum([
|
|
79
|
+
"UNAUTHORIZED",
|
|
80
|
+
"TENANT_MISMATCH",
|
|
81
|
+
"STALE_VERSION",
|
|
82
|
+
"HOST_REQUIRED",
|
|
83
|
+
"RATE_LIMITED",
|
|
84
|
+
"INVALID_MESSAGE",
|
|
85
|
+
]),
|
|
86
|
+
message: z.string().max(200),
|
|
87
|
+
}),
|
|
88
|
+
]);
|
|
89
|
+
export const PlayerSessionClaimsSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
issuer: z.literal("lokiplay"),
|
|
92
|
+
audience: z.literal("lokiplay-game"),
|
|
93
|
+
subject: z.string().uuid(),
|
|
94
|
+
projectId: z.string().uuid(),
|
|
95
|
+
organizationId: z.string().uuid(),
|
|
96
|
+
guest: z.boolean(),
|
|
97
|
+
issuedAt: z.number().int(),
|
|
98
|
+
expiresAt: z.number().int(),
|
|
99
|
+
nonce: z.string().uuid(),
|
|
100
|
+
})
|
|
101
|
+
.strict();
|
|
102
|
+
export function canonicalJson(value) {
|
|
103
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
104
|
+
return JSON.stringify(value);
|
|
105
|
+
}
|
|
106
|
+
if (typeof value === "number") {
|
|
107
|
+
if (!Number.isFinite(value) || !Number.isSafeInteger(value)) {
|
|
108
|
+
throw new Error("protocol numbers must be finite safe integers");
|
|
109
|
+
}
|
|
110
|
+
return JSON.stringify(value);
|
|
111
|
+
}
|
|
112
|
+
if (Array.isArray(value)) {
|
|
113
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
114
|
+
}
|
|
115
|
+
if (typeof value === "object") {
|
|
116
|
+
const object = value;
|
|
117
|
+
return `{${Object.keys(object)
|
|
118
|
+
.sort()
|
|
119
|
+
.map((key) => `${JSON.stringify(key)}:${canonicalJson(object[key])}`)
|
|
120
|
+
.join(",")}}`;
|
|
121
|
+
}
|
|
122
|
+
throw new Error("value is not JSON-compatible");
|
|
123
|
+
}
|
|
124
|
+
export function stateHash(value) {
|
|
125
|
+
return createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,OAAO;IACP,SAAS;IACT,UAAU;IACV,kBAAkB;IAClB,WAAW;IACX,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,M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ED,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lokiplay/protocol",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared schemas, message types, and hashing utilities for Loki.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -b --force",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"zod": "^4.5.2"
|
|
32
|
+
}
|
|
33
|
+
}
|