diff --git a/docs/.astro/settings.json b/docs/.astro/settings.json index 86be1fa..9e6829d 100644 --- a/docs/.astro/settings.json +++ b/docs/.astro/settings.json @@ -1,5 +1,5 @@ { "_variables": { - "lastUpdateCheck": 1723469654656 + "lastUpdateCheck": 1723148542874 } -} \ No newline at end of file +} diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index f55b427..9c593d0 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -58,10 +58,6 @@ export default defineConfig({ items: [{ label: "Introduction", link: "/server/introduction", - badge: { - text: "WIP", - variant: "caution" - } }, { label: "Running locally", @@ -74,10 +70,6 @@ export default defineConfig({ { label: "Integrations", link: "/server/integrations", - badge: { - text: "WIP", - variant: "caution" - } }, ...openAPISidebarGroups, ] diff --git a/docs/src/content/docs/server/integrations.md b/docs/src/content/docs/server/integrations.md index cbe7dfc..7178e12 100644 --- a/docs/src/content/docs/server/integrations.md +++ b/docs/src/content/docs/server/integrations.md @@ -3,13 +3,43 @@ title: "Server: Integrations" sidebar: order: 3 label: 'Integrations' - badge: - text: "WIP" - variant: caution next: false --- +### NGINX + +The official Docker image supports ENV variable substitution in the template folder. +Add your distribution to the container under `/usr/share/nginx/html` +Make sure to configure a `LIQUID_API_HOST` ENV variable that points to your deployed Liquid Auth API. + +```nginx +///etc/nginx/template/default.conf.template + +server { + listen 80; + listen [::]:80; + server_name localhost; + + root /usr/share/nginx/html; + + location / { + index index.html index.htm; + expires -1; + try_files $uri $uri/ @fallback; + } + + location @fallback { + proxy_set_header Host ${LIQUID_API_HOST}; + proxy_set_header X-Real-IP $remote_addr; + proxy_ssl_server_name on; + proxy_pass https://${LIQUID_API_HOST}; + } +} + +``` + ### Vite +> We recommend running a proxy server like Nginx in production. This will work for local development ```typescript //vite.config.ts @@ -32,59 +62,107 @@ export default defineConfig({ }) ``` -### Nest.js[WIP] +### Next.js +> We recommend running a proxy server like Nginx in production. This will work in a pinch or to test locally. + +Deploy the service to a platform like Render or AWS then configure the Proxy in `next.config.js`. + +```typescript +//next.config.js +/** @type {import('next').NextConfig} */ + +const serverURL = "https://my-liquid-service.com"; + +const nextConfig = { + trailingSlash: true, + async rewrites() { + return [ + { + source: '/auth/:path*', + destination: `${serverURL}/auth/:path*`, + }, + { + source: '/.well-known/:path*', + destination: `${serverURL}/.well-known/:path*`, + }, + { + source: '/attestation/:path*', + destination: `${serverURL}/attestation/:path*`, + }, -```javascript -//server.js -// import {AppModule} from '@algorandfoundation/liquid-auth-api' + { + source: '/assertion/:path*', + destination: `${serverURL}/assertion/:path*`, + }, + { + source: '/socket.io/', + destination: `${serverURL}/socket.io/`, + }, + { + source: '/socket.io', + destination: `${serverURL}/socket.io/`, + }, + ] + }, +}; + +export default nextConfig; ``` -### Next.js[WIP] +### Nest.js[WIP] +> Warning, the Service package is not available publicly. +> Please contact if you are interested in mounting the server -```javascript -//next.config.js -// module.exports = { -// async rewrites() { -// return [ -// { -// source: '/blog', -// destination: 'https://acme.com/blog', -// }, -// ] -// }, -// } +See the [Demo Express](https://github.com/algorandfoundation/liquid-auth/blob/develop/sites/express-dapp/src/main.ts) app for an example of how to mount the server. + +```shell +npm install @algorandfoundation/liquid-server --save ``` -### Express.js[WIP] +```typescript +//src/main.ts +import { AppModule, RedisIoAdapter } from '@algorandfoundation/liquid-server'; -```javascript -//server.js -// import {AppModule} from '@algorandfoundation/liquid-auth-api' +async function bootstrap() { + const app = await NestFactory.create(AppModule); + app.useWebSocketAdapter(new RedisIoAdapter(app)); + await app.listen(3000); +} ``` -### Vercel[WIP] +### Vercel +> We recommend running a proxy server like Nginx in production. This will work in a pinch ```json //vercel.json { "rewrites": [ { - "source": "/blog", - "destination": "https://acme.com/blog" + "source": "/auth/:path*", + "destination": "${serverURL}/auth/:path*" + }, + { + "source": "/.well-known/:path*", + "destination": "${serverURL}/.well-known/:path*" + }, + { + "source": "/attestation/:path*", + "destination": "/attestation/:path*" + }, + + { + "source": "/assertion/:path*", + "destination": "${serverURL}/assertion/:path*" + }, + { + "source": "/socket.io/", + "destination": "${serverURL}/socket.io/" + }, + { + "source": "/socket.io", + "destination": "${serverURL}/socket.io/" } ] } ``` -### Cloudflare[WIP] - -```toml -#wrangler.toml - -``` - -### NGINX [WIP] -```nginx -//default.conf -#todo Add Nginx proxy configuration -``` diff --git a/docs/src/content/docs/server/introduction.md b/docs/src/content/docs/server/introduction.md index 5c2be42..5bf6b03 100644 --- a/docs/src/content/docs/server/introduction.md +++ b/docs/src/content/docs/server/introduction.md @@ -4,9 +4,6 @@ prev: false sidebar: order: 0 label: 'Introduction' - badge: - text: "WIP" - variant: caution --- Liquid Auth is a self-hosted authentication service that provides a simple way to associate Passkeys to KeyPair(s) commonly found in cryptocurrencies. @@ -17,3 +14,9 @@ It is built using the [NestJS](https://nestjs.com/) framework and uses [mongoose](https://docs.nestjs.com/techniques/mongodb) to interact with MongoDB. Signaling is handled using [Socket.IO](https://docs.nestjs.com/websockets/gateways) backed by a [Redis Adapter](https://socket.io/docs/v4/redis-adapter/). + +The service request to be running on the same origin as the dApp. +We recommend configuring your frontend service to proxy requests to the authentication service. + + +