vcapi-workers / Exports / models/session
Module: models/session
VCAPI のセッションに関するドメイン知識
Table of contents
Type Aliases
Variables
Functions
Type Aliases
SessionCookieJwtPayload
Ƭ SessionCookieJwtPayload: z.infer<typeof sessionCookieJwtPayloadSchema>
Cookie から取り出したセッション情報の jwt payload
Defined in
src/models/session.ts:83 (opens in a new tab)
SessionInContext
Ƭ SessionInContext: Object
`c.get('session') で得られるセッションの型
Type declaration
| Name | Type | Description |
|---|---|---|
data | JSONObject & { _keys: { encrypt: string ; sign: string } } | セッションデータ 連想配列JSON |
id | string | - |
set | (key: string, value: JSONValue) => Promise<void> | セッションの data に key = value を設定する |
user? | { displayName: string ; id: number } | 現在のセッションのユーザー。ログインしている場合には存在 |
user.displayName | string | - |
user.id | number | - |
world | { id: number ; worldKey: Uint8Array } | 現在のセッションのワールド |
world.id | number | - |
world.worldKey | Uint8Array | - |
Defined in
src/models/session.ts:17 (opens in a new tab)
Variables
sessionCookieJwtPayloadSchema
• Const sessionCookieJwtPayloadSchema: ZodObject<{ exp: ZodEffects<ZodNumber, Date, number> ; iat: ZodEffects<ZodNumber, Date, number> ; iss: ZodLiteral<"vcapi.net"> ; jti: ZodString ; sub: ZodNullable<ZodNumber> ; wid: ZodNumber }, "strip", ZodTypeAny, { exp: Date ; iat: Date ; iss: "vcapi.net" ; jti: string ; sub: null | number ; wid: number }, { exp: number ; iat: number ; iss: "vcapi.net" ; jti: string ; sub: null | number ; wid: number }>
Cookie から取り出したセッション情報の jwt payload の zod スキーマ
Defined in
src/models/session.ts:69 (opens in a new tab)
Functions
getWorldId
▸ getWorldId(path, query): Promise<number>
リクエストからワールドIDを得る
Parameters
| Name | Type |
|---|---|
path | string |
query | Object |
query.d? | string |
query.worldId? | string |
Returns
Promise<number>
Defined in
src/models/session.ts:42 (opens in a new tab)
newSessionPayload
▸ newSessionPayload(sessionId, worldId, userId): Object
セッション Cookie に設定する jwt に設定する payload を新しく作る
Parameters
| Name | Type |
|---|---|
sessionId | string |
worldId | number |
userId | null | number |
Returns
Object
| Name | Type |
|---|---|
exp | number |
iat | number |
iss | string |
jti | string |
sub | null | number |
wid | number |