Skip to content

Commit

Permalink
Merge branch 'develop' into docs/peer-section-ENG-483
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/.astro/settings.json
  • Loading branch information
PhearZero committed Aug 12, 2024
2 parents 5a0e110 + 6e2764f commit a075c9d
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 52 deletions.
4 changes: 2 additions & 2 deletions docs/.astro/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_variables": {
"lastUpdateCheck": 1723469654656
"lastUpdateCheck": 1723148542874
}
}
}
8 changes: 0 additions & 8 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ export default defineConfig({
items: [{
label: "Introduction",
link: "/server/introduction",
badge: {
text: "WIP",
variant: "caution"
}
},
{
label: "Running locally",
Expand All @@ -74,10 +70,6 @@ export default defineConfig({
{
label: "Integrations",
link: "/server/integrations",
badge: {
text: "WIP",
variant: "caution"
}
},
...openAPISidebarGroups,
]
Expand Down
156 changes: 117 additions & 39 deletions docs/src/content/docs/server/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
9 changes: 6 additions & 3 deletions docs/src/content/docs/server/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.



0 comments on commit a075c9d

Please sign in to comment.