@gjermundgaraba/clankerauth-dev 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @gjermundgaraba/clankerauth-dev
2
2
 
3
- A disposable [Clanker Auth](https://github.com/gjermundgaraba/clankerauth) issuer for developing and testing applications that authenticate against one. The package bundles the whole server and dashboard with no dependencies, so it needs only Node 26 or newer.
3
+ A disposable [clankerauth](https://github.com/gjermundgaraba/clankerauth) issuer for developing and testing applications that authenticate against one. The package bundles the whole server and dashboard with no dependencies, so it needs only Node 26 or newer.
4
4
 
5
5
  ```sh
6
6
  npm install --save-dev @gjermundgaraba/clankerauth-dev
@@ -50,7 +50,7 @@ const token = await issuer.ownerToken({
50
50
  Pass `dataDir` and a fixed `port` to keep the issuer's state:
51
51
 
52
52
  ```ts
53
- const issuer = await startDisposableIssuer({ ...options, dataDir: ".dev/auth", port: 5174 });
53
+ const issuer = await startDisposableIssuer({ ...options, dataDir: ".dev/clankerauth", port: 5174 });
54
54
  ```
55
55
 
56
56
  The owner account and password, the signing secret, the registered client and the database are kept in that directory, and provisioning is idempotent, so the next start reuses them: the same sign-in works, API keys minted before still verify, and browser storage keyed by the origin survives. A fixed port is part of that, because the origin is what cookies and registered redirect URIs are keyed by. `close()` leaves the directory alone. Treat it as the whole secret of the workspace and keep it out of version control. `credentials.json` is written and read by this package alone and is validated against its schema on every start, so an edited or truncated file is refused rather than half-read. Without `dataDir`, nothing changes: a temporary directory, a random port, and everything removed by `close()`.
@@ -64,7 +64,7 @@ const issuer = await startDisposableIssuer({
64
64
  cookieDomain: "notes.localhost",
65
65
  });
66
66
 
67
- issuer.url; // http://auth.notes.localhost:<port>
67
+ issuer.url; // http://clankerauth.notes.localhost:<port>
68
68
  ```
69
69
 
70
70
  The issuer then serves `/forward-auth?resource=<identifier>`, `/forward-auth/continue` and `/forward-auth/logout`, and shares its forward cookie with every host under the domain, so serve the app on one, such as `app.notes.localhost`. Browsers and Node resolve `.localhost` names to loopback without a hosts-file entry. A signed-in owner's check answers `204` with an `Authorization` header to copy upstream; without a session, a page navigation (`Sec-Fetch-Mode: navigate`) is redirected through sign-in and any other request is `401`. Without `cookieDomain` the issuer is `http://127.0.0.1:<port>` and these routes are not served.
@@ -79,7 +79,7 @@ import { forwardAuth, reserveLoopbackPort } from "@gjermundgaraba/clankerauth-de
79
79
  export default defineConfig({
80
80
  plugins: [
81
81
  forwardAuth({
82
- issuer: "http://auth.notes.localhost:5174",
82
+ issuer: "http://clankerauth.notes.localhost:5174",
83
83
  appOrigin: "http://app.notes.localhost:5173",
84
84
  resource: "http://app.notes.localhost:5173/",
85
85
  sockets: { backend: "http://127.0.0.1:8080", paths: ["/eventlog"] },
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export interface DisposableIssuerOptions {
3
3
  client: { name: string; redirect: string; resources: string[] };
4
4
  /**
5
5
  * Serve forward auth for apps under this domain, such as `notes.localhost`. The issuer is
6
- * then `http://auth.<cookieDomain>:<port>` on the same loopback listener, and the forward
6
+ * then `http://clankerauth.<cookieDomain>:<port>` on the same loopback listener, and the forward
7
7
  * cookie is shared with every host under the domain. Without it, the issuer is
8
8
  * `http://127.0.0.1:<port>` and the forward-auth routes are not served.
9
9
  */