diff --git a/documentation-v3/src/reference/main/AuthRequest/deleteSessionCookie.md b/documentation-v3/src/reference/main/AuthRequest/deleteSessionCookie.md new file mode 100644 index 000000000..709e51c63 --- /dev/null +++ b/documentation-v3/src/reference/main/AuthRequest/deleteSessionCookie.md @@ -0,0 +1,11 @@ +--- +type: "method" +--- + +Deletes the session cookie by setting a cookie that expires immediately. + +## Definition + +```ts +function deleteSessionCookie(): void; +``` diff --git a/documentation-v3/src/reference/main/AuthRequest/index.md b/documentation-v3/src/reference/main/AuthRequest/index.md index e69de29bb..a3286fdbd 100644 --- a/documentation-v3/src/reference/main/AuthRequest/index.md +++ b/documentation-v3/src/reference/main/AuthRequest/index.md @@ -0,0 +1,29 @@ +--- +type: "class" +--- + +The core API. + +## Constructor + +```ts +//$ Lucia=ref:main +//$ SessionCookie=ref:main +//$ RequestContext=ref:main +function constructor<_Lucia extends $$Lucia = Lucia>( + lucia: _Lucia, + requestContext: $$RequestContext +): this; +``` + +### Parameters + +- `lucia` +- `sessionCookie` + +## Method + +- [`deleteSessionCookie()`](ref:main/AuthRequest) +- [`setSessionCookie()`](ref:main/AuthRequest) +- [`validate()`](ref:main/AuthRequest) +- [`validateBearerToken()`](ref:main/AuthRequest) \ No newline at end of file diff --git a/documentation-v3/src/reference/main/AuthRequest/setSessionCookie.md b/documentation-v3/src/reference/main/AuthRequest/setSessionCookie.md index e69de29bb..47756340c 100644 --- a/documentation-v3/src/reference/main/AuthRequest/setSessionCookie.md +++ b/documentation-v3/src/reference/main/AuthRequest/setSessionCookie.md @@ -0,0 +1,16 @@ +--- +type: "method" +--- + +Sets a session cookie for the provided session. + +## Definition + +```ts +function setSessionCookie(): void +``` + +### Parameters + +- `userId` +- `attributes`: Database session attributes diff --git a/documentation-v3/src/reference/main/AuthRequest/validate.md b/documentation-v3/src/reference/main/AuthRequest/validate.md index e69de29bb..2f6707f49 100644 --- a/documentation-v3/src/reference/main/AuthRequest/validate.md +++ b/documentation-v3/src/reference/main/AuthRequest/validate.md @@ -0,0 +1,11 @@ +--- +type: "method" +--- + +Validates the session cookie. --TODO--- + +## Definition + +```ts +function validate(): Promise<{ user: User; session: Session } | { user: null; session: null }>; +``` diff --git a/documentation-v3/src/reference/main/AuthRequest/validateBearerToken.md b/documentation-v3/src/reference/main/AuthRequest/validateBearerToken.md index e69de29bb..a7aec7ee6 100644 --- a/documentation-v3/src/reference/main/AuthRequest/validateBearerToken.md +++ b/documentation-v3/src/reference/main/AuthRequest/validateBearerToken.md @@ -0,0 +1,13 @@ +--- +type: "method" +--- + +Validates the bearer token in the `Authorization` header. --TODO--- + +## Definition + +```ts +function validateBearerToken(): Promise< + { user: User; session: Session } | { user: null; session: null } +>; +```