From c1c049d404d3491efb4918dc65db135671fe9a04 Mon Sep 17 00:00:00 2001
From: Adam Soltys
Date: Wed, 8 Oct 2025 10:52:37 -0700
Subject: display read-only token
---
src/routes/(static)/docs/+page.server.ts | 5 ++++-
src/routes/(static)/docs/+page.svelte | 35 ++++++++++++++++++++++++++------
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/src/routes/(static)/docs/+page.server.ts b/src/routes/(static)/docs/+page.server.ts
index 86f95824..93ba544c 100644
--- a/src/routes/(static)/docs/+page.server.ts
+++ b/src/routes/(static)/docs/+page.server.ts
@@ -1,4 +1,7 @@
+import { auth, get } from "$lib/utils";
export const load = async ({ cookies }) => {
const token = cookies.get("token");
- return { token };
+ let ro;
+ if (token) ro = await get("/ro", auth(cookies));
+ return { ro, token };
};
diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte
index f53787e5..c323f9bd 100644
--- a/src/routes/(static)/docs/+page.svelte
+++ b/src/routes/(static)/docs/+page.svelte
@@ -7,7 +7,7 @@
let { data } = $props();
- let { user, token } = data;
+ let { user, ro, token } = data;
let api = PUBLIC_DOMAIN.includes("localhost")
? `${PUBLIC_COINOS_URL}`
@@ -16,6 +16,8 @@
let tokenSample = token
? `export token="${token}"`
: `export token=`;
+
+ let roSample = `export token="${ro}"`;
{#snippet cp(something)}
@@ -59,7 +61,7 @@
or get one from the /login endpoint.
{/if}
- Save it in a variable called $token to run the examples.
+ Save it in a variable called $token to run the examples. It gives full access to your account so keep it safe.
+ {#if ro}
+
+ This read-only token has permission to create invoices and fetch
+ payments but can't be used to make withdrawals
+
+
+
{roSample}
+ {@render cp(roSample)}
+
+ {/if}
+
POST /register
Register a new user account with a username and password
@@ -92,9 +107,13 @@
display
string - spaces allowed
currency
-
string - three-letter ISO currency code e.g. CAD or USD
+
+ string - three-letter ISO currency code e.g. CAD or USD
+
language
-
string - two-letter language code e.g. en, fr, es
+
+ string - two-letter language code e.g. en, fr, es
+
@@ -108,7 +127,9 @@
type (string, default: lightning)
bitcoin or lightning
fiat (boolean, default: false)
- whether the amount is denominated in satoshis or local currency
+
+ whether the amount is denominated in satoshis or local currency
+
amount (numeric)
amount to be paid
webhook (string, optional)
@@ -116,7 +137,9 @@
remote endpoint to call when the invoice is paid
secret (string, optional)
- a secret value passed to the webhook to authenticate the request
+
+ a secret value passed to the webhook to authenticate the request
+
--
cgit v1.2.3