Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Dec 9, 2023
1 parent ddf9ab5 commit 97ddae6
Show file tree
Hide file tree
Showing 28 changed files with 119 additions and 113 deletions.
2 changes: 1 addition & 1 deletion documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

```
pnpm dev
```
```
16 changes: 8 additions & 8 deletions documentation/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineConfig } from 'astro/config';
import { defineConfig } from "astro/config";

import tailwind from "@astrojs/tailwind";

// https://astro.build/config
export default defineConfig({
markdown: {
shikiConfig: {
"theme": "css-variables"
}
},
integrations: [tailwind()]
});
markdown: {
shikiConfig: {
theme: "css-variables"
}
},
integrations: [tailwind()]
});
42 changes: 21 additions & 21 deletions documentation/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "documentation-v3",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/tailwind": "^5.0.0",
"astro": "^3.5.5",
"tailwindcss": "^3.0.24"
},
"devDependencies": {
"@astrojs/check": "^0.3.1",
"@tailwindcss/typography": "^0.5.10",
"typescript": "^5.2.2"
}
}
"name": "documentation-v3",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/tailwind": "^5.0.0",
"astro": "^3.5.5",
"tailwindcss": "^3.0.24"
},
"devDependencies": {
"@astrojs/check": "^0.3.1",
"@tailwindcss/typography": "^0.5.10",
"typescript": "^5.2.2"
}
}
3 changes: 2 additions & 1 deletion documentation/src/components/Head.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ interface Props {
title: string;
}
---

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
Expand All @@ -25,4 +26,4 @@ interface Props {
property="og:description"
content="Lucia is an open source auth library that abstracts away the complexity of handling sessions."
/>
</head>
</head>
4 changes: 2 additions & 2 deletions documentation/src/components/MarkdownArticle.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<article class="w-full md overflow-hidden">
<article class="md w-full overflow-hidden">
<slot />
</article>

Expand Down Expand Up @@ -28,7 +28,7 @@
@apply text-sm;
}
:global(.md pre code a) {
@apply underline decoration-main hover:text-main hover:no-underline;
@apply decoration-main hover:text-main underline hover:no-underline;
}
:global(.md pre) {
@apply mb-6 mt-4 w-full overflow-auto rounded-md bg-zinc-100 p-4 text-sm leading-snug;
Expand Down
2 changes: 1 addition & 1 deletion documentation/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="../.astro/types.d.ts" />
/// <reference path="../.astro/types.d.ts" />
62 changes: 31 additions & 31 deletions documentation/src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import NavMenu from "@components/NavMenu.astro";
import type { Section } from "@components/NavMenu.astro";
interface Props {
title: string;
sections: Section[];
Expand All @@ -13,46 +12,47 @@ interface Props {

<html lang="en">
<Head title={Astro.props.title} />
<body class="text-zinc-900 leading-relaxed">
<body class="leading-relaxed text-zinc-900">
<main class="w-full lg:px-8">
<nav class="lg:hidden w-full fixed border-b bg-white pt-3 pb-2 max-h-screen flex flex-col">
<header class="flex place-items-center place-content-between px-4 md:px-8">
<a href="/" class="font-medium text-xl">Lucia</a>
<nav class="fixed flex max-h-screen w-full flex-col border-b bg-white pb-2 pt-3 lg:hidden">
<header class="flex place-content-between place-items-center px-4 md:px-8">
<a href="/" class="text-xl font-medium">Lucia</a>
<button id="nav-button">Open</button>
</header>
<div class="px-4 md:px-8 overflow-auto overscroll-contain hidden pb-4" id="mobile-nav-menu">
<NavMenu sections={Astro.props.sections}/>
<div class="hidden overflow-auto overscroll-contain px-4 pb-4 md:px-8" id="mobile-nav-menu">
<NavMenu sections={Astro.props.sections} />
</div>
</nav>
<div class="max-w-5xl mx-auto w-full px-4 md:px-8 lg:px-0">
<div class="fixed w-56 shrink-0 hidden lg:block h-screen pt-8 pr-4">
<a href="/" class="font-medium text-2xl">Lucia</a>
<div class="overflow-auto h-full pb-24">
<NavMenu sections={Astro.props.sections}/>
<div class="mx-auto w-full max-w-5xl px-4 md:px-8 lg:px-0">
<div class="fixed hidden h-screen w-56 shrink-0 pr-4 pt-8 lg:block">
<a href="/" class="text-2xl font-medium">Lucia</a>
<div class="h-full overflow-auto pb-24">
<NavMenu sections={Astro.props.sections} />
</div>
</div>
<div class="lg:ml-56 pt-20 lg:pt-12 pb-24">
<div class="pb-24 pt-20 lg:ml-56 lg:pt-12">
<slot />
</div>
</div>
</main>
</body><style>
:root {
--astro-code-color-background: rgb(246, 246, 246);
--astro-code-token-keyword: rgb(235, 72, 105);
--astro-code-token-string-expression: rgb(77, 102, 183);
--astro-code-token-comment: rgb(143, 143, 143);
}
</style>

<script>
document.getElementById("nav-button")!.addEventListener("click", (e) => {
const navMenu = document.getElementById("mobile-nav-menu")!;
if (navMenu.classList.contains("hidden")) {
navMenu.classList.remove("hidden");
} else {
navMenu.classList.add("hidden");
<style>
:root {
--astro-code-color-background: rgb(246, 246, 246);
--astro-code-token-keyword: rgb(235, 72, 105);
--astro-code-token-string-expression: rgb(77, 102, 183);
--astro-code-token-comment: rgb(143, 143, 143);
}
});
</script>
</style>

<script>
document.getElementById("nav-button")!.addEventListener("click", (e) => {
const navMenu = document.getElementById("mobile-nav-menu")!;
if (navMenu.classList.contains("hidden")) {
navMenu.classList.remove("hidden");
} else {
navMenu.classList.add("hidden");
}
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion documentation/src/pages/guides/email-and-password/2fa.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ declare module "lucia" {

## Create QR code

When the user signs up, set `two_factor_secret` to `null` to indicate the user has yet to set up two-factor authorization.
When the user signs up, set `two_factor_secret` to `null` to indicate the user has yet to set up two-factor authorization.

```ts
app.post("/signup", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ Extract the email verification token from the URL and validate by checking the e
import { isWithinExpiration } from "oslo";

app.get("email-verification/*", async () => {

// ...

// there are better ways to do this - check your framework's API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ title: "Login throttling"

```
still working on this one!
```
```
2 changes: 1 addition & 1 deletion documentation/src/pages/guides/oauth/account-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ title: "Account linking"

```
still working on this one!
```
```
2 changes: 1 addition & 1 deletion documentation/src/pages/guides/oauth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ For a step-by-step, framework specific tutorial, see the [GitHub OAuth]() tutori
- [Multiple OAuth providers](/guides/oauth/multiple-providers)
- [PKCE](/guides/oauth/pkce)
- [Account linking](/guides/oauth/account-linking)
- [Custom OAuth providers](/guides/oauth/custom-providers)
- [Custom OAuth providers](/guides/oauth/custom-providers)
29 changes: 18 additions & 11 deletions documentation/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,38 @@ const contributors = await getGithubContributors();
---

<MainLayout title="Lucia">
<h1 class="text-5xl font-semibold py-6"><span class="text-main">Lucia</span><br>Auth, simple and clean</h1>
<h1 class="py-6 text-5xl font-semibold">
<span class="text-main">Lucia</span><br />Auth, simple and clean
</h1>
<p class="mt-6">
Lucia is an auth library that abstracts away the complexity of handling sessions. It works
alongside your database to provide an API that's easy to use, understand, and extend. <a
href="/getting-started"
class="hover:underline text-main w-fit">Get started →</a
class="text-main w-fit hover:underline">Get started →</a
>
</p>

<Code code={code} theme="css-variables" lang="ts" />
<section class="my-12">
<h2 class="text-3xl font-medium mb-4">It just works</h2>
<h2 class="mb-4 text-3xl font-medium">It just works</h2>
<ul>
<li><span class="font-medium text-main">✓</span> No more endless configuration and callbacks</li>
<li><span class="font-medium text-main">✓</span> Fully typed</li>
<li><span class="font-medium text-main">✓</span> Works in any runtime - Node.js, Bun, Deno, Cloudflare Workers</li>
<li><span class="font-medium text-main">✓</span> Extensive database support</li>
<li><span class="font-medium text-main">✓</span> Built-in support for popular frameworks</li>
<li><span class="font-medium text-main">✓</span> Comprehensive documentation and guides</li>
<li>
<span class="text-main font-medium">✓</span> No more endless configuration and callbacks
</li>
<li><span class="text-main font-medium">✓</span> Fully typed</li>
<li>
<span class="text-main font-medium">✓</span> Works in any runtime - Node.js, Bun, Deno, Cloudflare
Workers
</li>
<li><span class="text-main font-medium">✓</span> Extensive database support</li>
<li><span class="text-main font-medium">✓</span> Built-in support for popular frameworks</li>
<li><span class="text-main font-medium">✓</span> Comprehensive documentation and guides</li>
</ul>
</section>
<section class="my-12">
<h2 class="text-3xl font-medium mb-4">Free and open source</h2>
<h2 class="mb-4 text-3xl font-medium">Free and open source</h2>
<p>Lucia is a free and open source project, made possible by our contributors!</p>
<div class="flex w-full max-w-4xl flex-wrap place-content-center gap-2 mt-6">
<div class="mt-6 flex w-full max-w-4xl flex-wrap place-content-center gap-2">
{
contributors.map((contributor) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: "Lucia.createBlankSessionCookie()"
format: "code"
---

Method of [`Lucia`](/reference/main/Lucia). Creates a new cookie with a blank value that expires immediately to delete the existing session cookie.
Method of [`Lucia`](/reference/main/Lucia). Creates a new cookie with a blank value that expires immediately to delete the existing session cookie.

## Definition

```ts
//$ SessionCookie=/reference/main/SessionCookie
function createBlankSessionCookie(): $$SessionCookie;
```
```
14 changes: 7 additions & 7 deletions documentation/src/pages/reference/main/Lucia/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ function constructor<
- `options`:
- `sessionExpiresIn`: How long a session lasts for maximum for inactive users
- `sessionCookie`: Session cookie options
- `name`: Cookie name (default: `auth_session`)
- `expires`: Set to `false` for cookies to persist indefinitely (default: `true`)
- `attributes`: Cookie attributes
- `sameSite`
- `domain`
- `path`
- `secure`
- `name`: Cookie name (default: `auth_session`)
- `expires`: Set to `false` for cookies to persist indefinitely (default: `true`)
- `attributes`: Cookie attributes
- `sameSite`
- `domain`
- `path`
- `secure`
- `getSessionAttributes()`: Transforms database session attributes and the returned object is added to the [`Session`](/reference/main/Session) object
- `getUserAttributes()`: Transforms database user attributes and the returned object is added to the [`User`](/reference/main/User) object

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Method of [`Lucia`](/reference/main/Lucia). Invalidates a session.
## Definition

```ts
function invalidateSession(sessionId: string): Promise<void>
function invalidateSession(sessionId: string): Promise<void>;
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Method of [`Lucia`](/reference/main/Lucia). Invalidates all sessions of a user.
## Definition

```ts
function invalidateUserSessions(userId: string): Promise<void>
function invalidateUserSessions(userId: string): Promise<void>;
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ title: "Lucia.readBearerToken()"
format: "code"
---

Method of [`Lucia`](/reference/main/Lucia). Reads the bearer token from the `Authorization`` header. Returns `null` if the token doesn't exist.
Method of [`Lucia`](/reference/main/Lucia). Reads the bearer token from the ` Authorization`` header. Returns `null` if the token doesn't exist.

## Definition

```ts
function readBearerToken(authorizationHeader: string): string | null
function readBearerToken(authorizationHeader: string): string | null;
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Method of [`Lucia`](/reference/main/Lucia). Reads the session cookie from the `C
## Definition

```ts
function readSessionCookie(cookieHeader: string): string | null
function readSessionCookie(cookieHeader: string): string | null;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion documentation/src/pages/reference/main/Scrypt/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "Scrypt"
format: "code"
---

A pure JS implementation of Scrypt. Provides methods for hashing passwords and verifying hashes with [scrypt](https://datatracker.ietf.org/doc/html/rfc7914). By default, the configuration is set to [the recommended values](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).
A pure JS implementation of Scrypt. Provides methods for hashing passwords and verifying hashes with [scrypt](https://datatracker.ietf.org/doc/html/rfc7914). By default, the configuration is set to [the recommended values](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).

The output hash is a combination of the scrypt hash and the 32-bytes salt, in the format of `<salt>:<hash>`.

Expand Down
3 changes: 1 addition & 2 deletions documentation/src/pages/reference/main/Session.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ interface Session extends SessionAttributes {
}
```


### Properties

- `id`
- `expiresAt`
- `fresh`: `true` if session was newly created or its expiration was extended
- `userId`
- `userId`
2 changes: 1 addition & 1 deletion documentation/src/pages/reference/main/SessionCookie.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ title: "SessionCookie"
format: "code"
---

See [`SessionCookie`](https://oslo.js.org/reference/main/session/SessionCookie/) from `oslo/session`.
See [`SessionCookie`](https://oslo.js.org/reference/main/session/SessionCookie/) from `oslo/session`.
2 changes: 1 addition & 1 deletion documentation/src/pages/reference/main/TimeSpan.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ title: "TimeSpan"
format: "code"
---

See [`TimeSpan`](https://oslo.js.org/reference/main/main/TimeSpan/) from `oslo`.
See [`TimeSpan`](https://oslo.js.org/reference/main/main/TimeSpan/) from `oslo`.
Loading

0 comments on commit 97ddae6

Please sign in to comment.