@gjermundgaraba/clankerauth 0.28.0 → 0.28.1
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 +7 -8
- package/package.json +4 -4
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
|
@@ -400,7 +400,7 @@ const OwnerHttp = ActionHttp.make(Administration, {
|
|
|
400
400
|
});
|
|
401
401
|
//#endregion
|
|
402
402
|
//#region package.json
|
|
403
|
-
var version = "0.28.
|
|
403
|
+
var version = "0.28.1";
|
|
404
404
|
//#endregion
|
|
405
405
|
//#region src/main.ts
|
|
406
406
|
const refused = (error) => new CliError.UserError({
|
|
@@ -437,15 +437,15 @@ const notSignedIn = new CliError.UserError({
|
|
|
437
437
|
cause: "not signed in",
|
|
438
438
|
userMessage: "Not signed in: run `clankerauth login <url>` first."
|
|
439
439
|
});
|
|
440
|
-
const issuerNamed = Config.option(Config.String("CLANKERAUTH_URL")).pipe(Effect.mapError(refused), Effect.
|
|
440
|
+
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
441
|
cause: "CLANKERAUTH_URL",
|
|
442
|
-
userMessage: "CLANKERAUTH_URL is no URL: set it to the issuer's origin, its CLANKERAUTH_BASE_URL."
|
|
443
|
-
})) : Effect.succeed(
|
|
442
|
+
userMessage: "CLANKERAUTH_URL is no issuer URL: set it to the issuer's origin, its CLANKERAUTH_BASE_URL."
|
|
443
|
+
})) : Effect.succeed(origin)));
|
|
444
444
|
const administrationSignIn = Effect.gen(function* () {
|
|
445
445
|
const named = yield* issuerNamed;
|
|
446
446
|
const kept = (yield* Credentials.list().pipe(Effect.mapError(refused))).filter((signIn) => signIn.resource === administrationIdentifier(signIn.url)).filter((signIn) => Option.match(named, {
|
|
447
447
|
onNone: () => true,
|
|
448
|
-
onSome: (
|
|
448
|
+
onSome: (origin) => origin === signIn.url
|
|
449
449
|
}));
|
|
450
450
|
const [only, ...others] = kept;
|
|
451
451
|
if (only === void 0) return yield* notSignedIn;
|
|
@@ -464,10 +464,9 @@ const administrationTarget = Effect.gen(function* () {
|
|
|
464
464
|
cause: "CLANKERAUTH_URL",
|
|
465
465
|
userMessage: "CLANKERAUTH_TOKEN is set without CLANKERAUTH_URL: set it to the issuer's origin, its CLANKERAUTH_BASE_URL."
|
|
466
466
|
});
|
|
467
|
-
const url = new URL(named.value).origin;
|
|
468
467
|
return {
|
|
469
|
-
url,
|
|
470
|
-
resource: administrationIdentifier(
|
|
468
|
+
url: named.value,
|
|
469
|
+
resource: administrationIdentifier(named.value)
|
|
471
470
|
};
|
|
472
471
|
});
|
|
473
472
|
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* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjermundgaraba/clankerauth",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1",
|
|
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": {
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@effect/platform-node": "4.0.5",
|
|
23
23
|
"@effect/platform-node-shared": "4.0.5",
|
|
24
|
-
"@gjermundgaraba/clankerauth-sdk": "0.28.
|
|
24
|
+
"@gjermundgaraba/clankerauth-sdk": "0.28.1",
|
|
25
25
|
"@gjermundgaraba/effect-actions": "0.19.0",
|
|
26
26
|
"effect": "4.0.5"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gjermundgaraba/clankerauth-admin-api": "0.28.
|
|
30
|
-
"@gjermundgaraba/clankerauth-dev": "0.28.
|
|
29
|
+
"@gjermundgaraba/clankerauth-admin-api": "0.28.1",
|
|
30
|
+
"@gjermundgaraba/clankerauth-dev": "0.28.1",
|
|
31
31
|
"@types/node": "26.6.5",
|
|
32
32
|
"typescript": "7.0.2",
|
|
33
33
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|