@kanonak-protocol/cli 5.8.0 → 5.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.
@@ -0,0 +1,38 @@
1
+ import { DeviceCertificateStore } from '@kanonak-protocol/sdk';
2
+ /**
3
+ * Publisher-centric authority resolution — the ONE way every CLI command turns
4
+ * what the user typed into the authority that actually keys an enrollment /
5
+ * session.
6
+ *
7
+ * Users think in PUBLISHERS (`paul.kanonak.com`) — the domain they `connect`,
8
+ * `enroll`, `install` from. But device certs and the sessions minted from them
9
+ * are keyed by the AUTHORITY (`oauth--paul.kanonak.com`), which the user neither
10
+ * knows nor should have to type. The mapping is the enrollment record's
11
+ * `publisher` field, captured at `connect`/`enroll` time. These helpers read it
12
+ * (and fall back to RFC 9728 discovery) so `session login/token/logout/status`,
13
+ * `device show/remove`, etc. all speak the publisher domain.
14
+ */
15
+ export interface PublisherAuthorityDeps {
16
+ store?: Pick<DeviceCertificateStore, 'get' | 'list'>;
17
+ discovery?: {
18
+ discoverProtectedResource(host: string): Promise<string[] | null>;
19
+ };
20
+ }
21
+ /**
22
+ * Resolve the locally-enrolled AUTHORITY for what the user typed. Order:
23
+ * 1. Direct — the input is already an enrolled authority key (e.g. copied
24
+ * from `device list`/`session status`).
25
+ * 2. Local mapping — an enrollment recorded this publisher; resolve with no
26
+ * network call (the publisher-centric fast path).
27
+ * 3. Network fallback — resolve the publisher to its authority via RFC 9728
28
+ * `oauth-protected-resource` (covers enrollments made before the publisher
29
+ * was recorded).
30
+ * Returns the authority host that has a local enrollment, or null.
31
+ */
32
+ export declare function resolveEnrolledAuthority(input: string, deps?: PublisherAuthorityDeps): Promise<string | null>;
33
+ /**
34
+ * The publisher an enrolled authority was connected through, if it was recorded
35
+ * — for presenting authority-keyed state (sessions) in publisher terms. Returns
36
+ * undefined when the authority isn't enrolled locally or carries no publisher.
37
+ */
38
+ export declare function publisherForAuthority(authority: string, deps?: PublisherAuthorityDeps): Promise<string | undefined>;
@@ -4,6 +4,11 @@ import { Command } from 'commander';
4
4
  * auto-refreshing registry sessions (issue #72), for authenticating GIT to your
5
5
  * Kanonak package repositories.
6
6
  *
7
+ * Publisher-centric: every subcommand takes the PUBLISHER domain you connected
8
+ * to (`paul.kanonak.com`), not the OAuth authority host it resolves to. The
9
+ * mapping is the device enrollment captured by `connect`/`enroll`; see
10
+ * `resolveEnrolledAuthority`.
11
+ *
7
12
  * Scope: the CLI provides dynamic GIT authentication and does not manage
8
13
  * package-manager-native registry credentials. Kanonak packages live in Git, so
9
14
  * the git credential helper (plus Go's `GOAUTH=git` and any `git+https`