@kanonak-protocol/cli 5.5.0 → 5.6.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.
@@ -18,8 +18,9 @@ import type { FetchLike } from './IssuanceClient.js';
18
18
  /** The discovery capability the flow needs (satisfied by {@link OAuthDiscovery}). */
19
19
  export interface EnrollmentMetadataSource {
20
20
  discover(host: string): Promise<OAuthServerMetadata | null>;
21
- /** Resolve a Kanonak publisher to its authority issuer URL(s) via kanonak.json. */
22
- discoverKanonakAuthorities(host: string): Promise<string[] | null>;
21
+ /** Resolve a publisher to its authority issuer URL(s) via the always-public
22
+ * RFC 9728 `oauth-protected-resource` document. */
23
+ discoverProtectedResource(host: string): Promise<string[] | null>;
23
24
  }
24
25
  /** Just enough of {@link CredentialStore} to reuse a stored OAuth client_id. */
25
26
  export interface CredentialLookup {
@@ -1,4 +1,4 @@
1
- import type { LockFile, LockEntry, PublisherConfig, DeviceEnrollmentRecord, AuthenticatedFetchFn } from '@kanonak-protocol/sdk';
1
+ import type { LockFile, LockEntry, PublisherConfig, DeviceEnrollmentRecord, SessionRecord, AuthenticatedFetchFn } from '@kanonak-protocol/sdk';
2
2
  /** The outcome of a connect, for a host (CLI / VS Code) to report. */
3
3
  export interface ConnectResult {
4
4
  connected: boolean;
@@ -14,8 +14,9 @@ export interface ConnectResult {
14
14
  */
15
15
  export interface ConnectDeps {
16
16
  fetchFn?: AuthenticatedFetchFn;
17
+ /** Resolve a publisher to its authority via RFC 9728 oauth-protected-resource. */
17
18
  discovery?: {
18
- discoverKanonakAuthorities(host: string): Promise<string[] | null>;
19
+ discoverProtectedResource(host: string): Promise<string[] | null>;
19
20
  };
20
21
  configResolver?: {
21
22
  getConfig(host: string): Promise<PublisherConfig>;
@@ -26,6 +27,9 @@ export interface ConnectDeps {
26
27
  publisherIndex?: {
27
28
  getLock(host: string): Promise<LockFile | null>;
28
29
  };
30
+ sessionManager?: {
31
+ getValidSession(host: string): Promise<SessionRecord | null>;
32
+ };
29
33
  /** Run device enrollment for a publisher (resolves its authority internally). */
30
34
  enroll?: (publisher: string) => Promise<{
31
35
  success: boolean;
@@ -42,13 +46,17 @@ export interface ConnectDeps {
42
46
  log?: (message: string) => void;
43
47
  }
44
48
  /**
45
- * The `connect` orchestrator core (issue #9): given a publisher domain, discover
46
- * it (kanonak.json authorization_servers + featured_packages), enroll this
47
- * device if the publisher is gated and not already enrolled with its authority,
48
- * then install the featured packages and their pinned closures from the served
49
- * kanonak.lock. Pure of process/stdout concerns returns a {@link ConnectResult}
50
- * and reports progress through `deps.log` — so the CLI and VS Code wrap it the
51
- * same way. A public publisher (no authorization_servers) never enrolls.
49
+ * The `connect` orchestrator core (issue #9): given a publisher domain, learn
50
+ * whether it is gated from the always-public RFC 9728 `oauth-protected-resource`
51
+ * document, enroll this device if it is gated and not already enrolled, then
52
+ * read the publisher's `kanonak.json` (its `featured_packages`) and install them
53
+ * and their pinned closures from the served `kanonak.lock`.
54
+ *
55
+ * For a gated publisher the `kanonak.json`/`kanonak.lock` are themselves behind
56
+ * auth, so those reads go through the device session minted from the enrolled
57
+ * cert. A public publisher (no `oauth-protected-resource`) never enrolls and
58
+ * reads everything anonymously. Pure of process/stdout concerns — returns a
59
+ * {@link ConnectResult} and reports via `deps.log`.
52
60
  */
53
61
  export declare function connect(publisher: string, options: {
54
62
  install?: boolean;