@gjermundgaraba/clankerauth 0.28.0 → 0.29.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 +2 -2
- package/dist/main.mjs +10 -14
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ clankerauth logout
|
|
|
16
16
|
|
|
17
17
|
The sign-ins are kept in `$XDG_CONFIG_HOME/clankerauth/sign-ins.json`, `~/.config/clankerauth/sign-ins.json` by default, readable by their owner alone: one per resource, each with its own issuer, so signing in at a second issuer leaves the first's alone. A file the command cannot read, such as one another version wrote, counts as signed out and the next `login` replaces it. A `login` to a resource already signed in to replaces that sign-in and revokes it. A command refreshes an access token as it is about to expire and saves the rotated refresh token, so a sign-in lasts while it is used at least every 30 days; when the issuer refuses a refresh, the error names the `login` that asks for the same scopes again. Every change to the file holds its lock, so commands and programs running at once refresh an expired sign-in once, and `logout` revokes the refresh token that is current. `logout` revokes every sign-in and deletes the file, and `logout <url>` the one whose resource that URL is under alone.
|
|
18
18
|
|
|
19
|
-
Administration commands act at the issuer of the one administration sign-in kept. Signed in to administration at several issuers, name one with `CLANKERAUTH_URL`, its origin; a value that
|
|
19
|
+
Administration commands act at the issuer of the one administration sign-in kept. Signed in to administration at several issuers, name one with `CLANKERAUTH_URL`, its origin; a value that names no origin, such as a `mailto:` URL, is refused.
|
|
20
20
|
|
|
21
21
|
Unattended, such as in a container with no browser or disk to keep a sign-in on, the commands take an administration key, an API key granted on the issuer's origin root, from `CLANKERAUTH_TOKEN` instead, and then act at the issuer `CLANKERAUTH_URL` names, which they require. No sign-in is read or written. The owner creates the key once, signed in:
|
|
22
22
|
|
|
@@ -28,7 +28,7 @@ CLANKERAUTH_URL=https://clankerauth.home.example CLANKERAUTH_TOKEN=clankerauth_
|
|
|
28
28
|
clankerauth list-api-keys
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
What the key may do, and when a change to it applies, is in [the issuer's README](../../README.md#administer-unattended-with-an-api-key).
|
|
32
32
|
|
|
33
33
|
## Tokens for other commands
|
|
34
34
|
|
package/dist/main.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import * as Credentials from "@gjermundgaraba/clankerauth-sdk/credentials";
|
|
|
10
10
|
import * as Action from "@gjermundgaraba/effect-actions/Action";
|
|
11
11
|
import * as Authentication from "@gjermundgaraba/effect-actions/Authentication";
|
|
12
12
|
import { HttpApiSchema, HttpApiSecurity } from "effect/http-api";
|
|
13
|
-
|
|
13
|
+
// ../../packages/admin-api/dist/index.js
|
|
14
14
|
/**
|
|
15
15
|
* This issuer's own fault: a failed query, an unreadable row, an unexpected provider failure.
|
|
16
16
|
* The schema defines the public response; the diagnostic cause reaches logs, never a caller.
|
|
@@ -398,11 +398,9 @@ const OwnerHttp = ActionHttp.make(Administration, {
|
|
|
398
398
|
prefix: "/api/owner",
|
|
399
399
|
authentication: OwnerToken
|
|
400
400
|
});
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
//#endregion
|
|
405
|
-
//#region src/main.ts
|
|
401
|
+
// package.json
|
|
402
|
+
var version = "0.29.0";
|
|
403
|
+
// src/main.ts
|
|
406
404
|
const refused = (error) => new CliError.UserError({
|
|
407
405
|
cause: error,
|
|
408
406
|
userMessage: error.message
|
|
@@ -437,15 +435,15 @@ const notSignedIn = new CliError.UserError({
|
|
|
437
435
|
cause: "not signed in",
|
|
438
436
|
userMessage: "Not signed in: run `clankerauth login <url>` first."
|
|
439
437
|
});
|
|
440
|
-
const issuerNamed = Config.option(Config.String("CLANKERAUTH_URL")).pipe(Effect.mapError(refused), Effect.
|
|
438
|
+
const issuerNamed = Config.option(Config.String("CLANKERAUTH_URL")).pipe(Effect.mapError(refused), Effect.map(Option.map((url) => URL.parse(url)?.origin ?? "null")), Effect.flatMap((origin) => Option.contains(origin, "null") ? Effect.fail(new CliError.UserError({
|
|
441
439
|
cause: "CLANKERAUTH_URL",
|
|
442
|
-
userMessage: "CLANKERAUTH_URL is no URL: set it to the issuer's origin, its CLANKERAUTH_BASE_URL."
|
|
443
|
-
})) : Effect.succeed(
|
|
440
|
+
userMessage: "CLANKERAUTH_URL is no issuer URL: set it to the issuer's origin, its CLANKERAUTH_BASE_URL."
|
|
441
|
+
})) : Effect.succeed(origin)));
|
|
444
442
|
const administrationSignIn = Effect.gen(function* () {
|
|
445
443
|
const named = yield* issuerNamed;
|
|
446
444
|
const kept = (yield* Credentials.list().pipe(Effect.mapError(refused))).filter((signIn) => signIn.resource === administrationIdentifier(signIn.url)).filter((signIn) => Option.match(named, {
|
|
447
445
|
onNone: () => true,
|
|
448
|
-
onSome: (
|
|
446
|
+
onSome: (origin) => origin === signIn.url
|
|
449
447
|
}));
|
|
450
448
|
const [only, ...others] = kept;
|
|
451
449
|
if (only === void 0) return yield* notSignedIn;
|
|
@@ -464,10 +462,9 @@ const administrationTarget = Effect.gen(function* () {
|
|
|
464
462
|
cause: "CLANKERAUTH_URL",
|
|
465
463
|
userMessage: "CLANKERAUTH_TOKEN is set without CLANKERAUTH_URL: set it to the issuer's origin, its CLANKERAUTH_BASE_URL."
|
|
466
464
|
});
|
|
467
|
-
const url = new URL(named.value).origin;
|
|
468
465
|
return {
|
|
469
|
-
url,
|
|
470
|
-
resource: administrationIdentifier(
|
|
466
|
+
url: named.value,
|
|
467
|
+
resource: administrationIdentifier(named.value)
|
|
471
468
|
};
|
|
472
469
|
});
|
|
473
470
|
const tokenCommand = Command.make("token", { url: urlArgument("An address under the resource whose token to print, such as the application's URL; administration by default") }, ({ url }) => Effect.gen(function* () {
|
|
@@ -490,5 +487,4 @@ const cli = Command.make("clankerauth").pipe(Command.withDescription("Administer
|
|
|
490
487
|
...administration
|
|
491
488
|
]));
|
|
492
489
|
Command.run(cli, { version }).pipe(Effect.provide(FetchHttpClient.layer), Effect.provide(NodeServices.layer), ActionCli.logToStderr, NodeRuntime.runMain);
|
|
493
|
-
//#endregion
|
|
494
490
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjermundgaraba/clankerauth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "The clankerauth command line: sign in to an issuer as its owner and administer it over HTTP.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@effect/platform-node": "4.0.
|
|
23
|
-
"@effect/platform-node-shared": "4.0.
|
|
24
|
-
"@gjermundgaraba/clankerauth-sdk": "0.
|
|
25
|
-
"@gjermundgaraba/effect-actions": "0.
|
|
26
|
-
"effect": "4.0.
|
|
22
|
+
"@effect/platform-node": "4.0.6",
|
|
23
|
+
"@effect/platform-node-shared": "4.0.6",
|
|
24
|
+
"@gjermundgaraba/clankerauth-sdk": "0.29.0",
|
|
25
|
+
"@gjermundgaraba/effect-actions": "0.20.0",
|
|
26
|
+
"effect": "4.0.6"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gjermundgaraba/clankerauth-admin-api": "0.
|
|
30
|
-
"@gjermundgaraba/clankerauth-dev": "0.
|
|
29
|
+
"@gjermundgaraba/clankerauth-admin-api": "0.29.0",
|
|
30
|
+
"@gjermundgaraba/clankerauth-dev": "0.29.0",
|
|
31
31
|
"@types/node": "26.6.5",
|
|
32
32
|
"typescript": "7.0.2",
|
|
33
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
34
|
-
"vite-plus": "1.
|
|
33
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
34
|
+
"vite-plus": "1.4.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=26"
|