feat: unify device auth + pairing
This commit is contained in:
44
src/gateway/protocol/schema/devices.ts
Normal file
44
src/gateway/protocol/schema/devices.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
export const DevicePairListParamsSchema = Type.Object({}, { additionalProperties: false });
|
||||
|
||||
export const DevicePairApproveParamsSchema = Type.Object(
|
||||
{ requestId: NonEmptyString },
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const DevicePairRejectParamsSchema = Type.Object(
|
||||
{ requestId: NonEmptyString },
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const DevicePairRequestedEventSchema = Type.Object(
|
||||
{
|
||||
requestId: NonEmptyString,
|
||||
deviceId: NonEmptyString,
|
||||
publicKey: NonEmptyString,
|
||||
displayName: Type.Optional(NonEmptyString),
|
||||
platform: Type.Optional(NonEmptyString),
|
||||
clientId: Type.Optional(NonEmptyString),
|
||||
clientMode: Type.Optional(NonEmptyString),
|
||||
role: Type.Optional(NonEmptyString),
|
||||
scopes: Type.Optional(Type.Array(NonEmptyString)),
|
||||
remoteIp: Type.Optional(NonEmptyString),
|
||||
silent: Type.Optional(Type.Boolean()),
|
||||
isRepair: Type.Optional(Type.Boolean()),
|
||||
ts: Type.Integer({ minimum: 0 }),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const DevicePairResolvedEventSchema = Type.Object(
|
||||
{
|
||||
requestId: NonEmptyString,
|
||||
deviceId: NonEmptyString,
|
||||
decision: NonEmptyString,
|
||||
ts: Type.Integer({ minimum: 0 }),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
Reference in New Issue
Block a user