@kanonak-protocol/cli 5.6.0 → 5.8.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,21 @@
1
+ import { CredentialResolver } from '@kanonak-protocol/sdk';
2
+ import type { AuthenticatedFetchFn } from '@kanonak-protocol/sdk';
3
+ /**
4
+ * A fetch transport that authenticates GATED reads with the device session.
5
+ *
6
+ * Per host, it resolves the publisher → authority → device session
7
+ * (CredentialResolver) and presents the session token as `Authorization: Bearer`.
8
+ * A public publisher resolves to no credential and the request goes out
9
+ * anonymously. This is what makes `install` / `connect` read a gated publisher's
10
+ * `kanonak.json` / `kanonak.lock` / package sources — without it, those requests
11
+ * hit the gate unauthenticated.
12
+ *
13
+ * Crucially it uses `redirect: 'manual'`: a gated endpoint 302-redirects an
14
+ * unauthenticated request (e.g. to a login), and Node's default auto-following
15
+ * turns that into a redirect LOOP. Not following means a gated 302 surfaces as a
16
+ * clean non-OK response the caller reports, instead of spinning.
17
+ *
18
+ * The resolved credential is cached per host so one `connect`/`install` doesn't
19
+ * re-mint a session for every package in the closure.
20
+ */
21
+ export declare function createSessionFetch(resolver?: CredentialResolver): AuthenticatedFetchFn;
@@ -1,4 +1,4 @@
1
- import type { LockFile, LockEntry, PublisherConfig, DeviceEnrollmentRecord, SessionRecord, AuthenticatedFetchFn } from '@kanonak-protocol/sdk';
1
+ import type { LockFile, LockEntry, PublisherConfig, DeviceEnrollmentRecord, 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;
@@ -27,9 +27,6 @@ export interface ConnectDeps {
27
27
  publisherIndex?: {
28
28
  getLock(host: string): Promise<LockFile | null>;
29
29
  };
30
- sessionManager?: {
31
- getValidSession(host: string): Promise<SessionRecord | null>;
32
- };
33
30
  /** Run device enrollment for a publisher (resolves its authority internally). */
34
31
  enroll?: (publisher: string) => Promise<{
35
32
  success: boolean;