@kanonak-protocol/cli 4.20.0 → 5.1.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/dist/auth/enrollment/EnrollmentFlow.d.ts +1 -1
- package/dist/auth/oauthHelpers.d.ts +4 -5
- package/dist/auth/session/GitCredentialHelper.d.ts +47 -0
- package/dist/commands/credential.d.ts +10 -0
- package/dist/commands/credentialHelper.d.ts +10 -0
- package/dist/commands/session.d.ts +19 -0
- package/dist/index.js +241 -265
- package/dist/resolution/LocalResolution.d.ts +2 -2
- package/package.json +3 -3
- package/dist/auth/OAuthDiscovery.d.ts +0 -47
- package/dist/auth/OAuthFlow.d.ts +0 -33
- package/dist/commands/login.d.ts +0 -11
- package/dist/commands/logout.d.ts +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import type { DeviceEnrollmentRecord } from '@kanonak-protocol/sdk';
|
|
3
|
-
import type { OAuthServerMetadata } from '
|
|
3
|
+
import type { OAuthServerMetadata } from '@kanonak-protocol/sdk';
|
|
4
4
|
import type { KeyProvider, KeyType } from './KeyProvider.js';
|
|
5
5
|
import type { FetchLike } from './IssuanceClient.js';
|
|
6
6
|
/**
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reusable OAuth 2.0 / RFC 8252 native-app helpers
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* loopback + PKCE mechanics live in exactly one place.
|
|
2
|
+
* Reusable OAuth 2.0 / RFC 8252 native-app helpers: the loopback callback
|
|
3
|
+
* server, PKCE (RFC 7636) generation, the authorization-URL builder, and the
|
|
4
|
+
* system browser opener. `EnrollmentFlow` (device enrollment) builds on these so
|
|
5
|
+
* the loopback + PKCE mechanics live in exactly one place.
|
|
7
6
|
*/
|
|
8
7
|
export declare function generateCodeVerifier(): string;
|
|
9
8
|
export declare function generateCodeChallenge(verifier: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type CredentialResolverDeps } from '@kanonak-protocol/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* `kanonak` as a git credential helper (issue #72). Git invokes the helper per
|
|
4
|
+
* request; for a Kanonak-credentialed repository host it returns a freshly-valid
|
|
5
|
+
* session token, so pushes/pulls just work without static, expiring files.
|
|
6
|
+
*
|
|
7
|
+
* The actual resolution (RFC 9728 host→authority, then the authority-scoped
|
|
8
|
+
* device session) lives in the SDK's CredentialResolver — the durable primitive.
|
|
9
|
+
* This class owns only the git-specific concerns: the stdin/stdout protocol and
|
|
10
|
+
* the HTTP Basic user-id. Self-filtering: when the resolver declines (no Kanonak
|
|
11
|
+
* authority, or unenrolled), the helper emits nothing and git falls through.
|
|
12
|
+
* Identity is never inferred; the Basic user-id is an RFC 7617 carrier (the token
|
|
13
|
+
* is the credential).
|
|
14
|
+
*/
|
|
15
|
+
/** A git credential description (the key=value lines git sends on stdin). */
|
|
16
|
+
export interface GitCredential {
|
|
17
|
+
protocol?: string;
|
|
18
|
+
host?: string;
|
|
19
|
+
path?: string;
|
|
20
|
+
username?: string;
|
|
21
|
+
[key: string]: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface GitCredentialHelperDeps extends CredentialResolverDeps {
|
|
24
|
+
/** Carrier user-id when git's request supplies none (RFC 7617; not an identity). */
|
|
25
|
+
carrierUserId?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class GitCredentialHelper {
|
|
28
|
+
private readonly resolver;
|
|
29
|
+
private readonly carrier;
|
|
30
|
+
constructor(deps?: GitCredentialHelperDeps);
|
|
31
|
+
/**
|
|
32
|
+
* Resolve a git request to credentials, or null to DECLINE (git falls through).
|
|
33
|
+
*/
|
|
34
|
+
resolve(cred: GitCredential): Promise<{
|
|
35
|
+
username: string;
|
|
36
|
+
password: string;
|
|
37
|
+
} | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Run one git credential-helper invocation: parse the request from `input`,
|
|
40
|
+
* handle the operation, and return the stdout to emit ('' = decline). Only
|
|
41
|
+
* `get` produces credentials; `store`/`erase` are no-ops because Kanonak
|
|
42
|
+
* sessions are managed by `kanonak session`, not by git.
|
|
43
|
+
*/
|
|
44
|
+
run(operation: string, input: string): Promise<string>;
|
|
45
|
+
}
|
|
46
|
+
/** Parse git's credential stdin: `key=value` lines, blank-line terminated. */
|
|
47
|
+
export declare function parseGitCredential(input: string): GitCredential;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* `kanonak credential resolve <host>` — the durable host→credential primitive
|
|
4
|
+
* (issue #72), exposed for scripting. Given any registry/repo host, it resolves
|
|
5
|
+
* a freshly-valid credential (via RFC 9728 discovery + the authority-scoped
|
|
6
|
+
* device session) and prints it as JSON, or exits non-zero when Kanonak has none
|
|
7
|
+
* for that host. This is the same resolver the git credential helper uses; other
|
|
8
|
+
* tooling builds on it instead of reimplementing the auth.
|
|
9
|
+
*/
|
|
10
|
+
export declare function credentialCommand(): Command;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* `kanonak credential-helper <get|store|erase>` — a git credential helper
|
|
4
|
+
* (issue #72). Git invokes it (configured via `credential.helper = !kanonak
|
|
5
|
+
* credential-helper`), passing the credential description on stdin. For a
|
|
6
|
+
* repository host that advertises a Kanonak authority (RFC 9728), it returns a
|
|
7
|
+
* freshly-refreshed session token; for any other host it prints nothing, so git
|
|
8
|
+
* falls through to its normal flow. Not meant to be run by hand.
|
|
9
|
+
*/
|
|
10
|
+
export declare function credentialHelperCommand(): Command;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* `kanonak session` — turn an enrolled device certificate into scoped,
|
|
4
|
+
* auto-refreshing registry sessions (issue #72), for authenticating GIT to your
|
|
5
|
+
* Kanonak package repositories.
|
|
6
|
+
*
|
|
7
|
+
* Scope: the CLI provides dynamic GIT authentication and does not manage
|
|
8
|
+
* package-manager-native registry credentials. Kanonak packages live in Git, so
|
|
9
|
+
* the git credential helper (plus Go's `GOAUTH=git` and any `git+https`
|
|
10
|
+
* dependency fetch) is the universal mechanism; package-manager registry auth is
|
|
11
|
+
* out of scope here.
|
|
12
|
+
*
|
|
13
|
+
* `install-git-helper` wires `kanonak` in as a git credential helper; pushes and
|
|
14
|
+
* pulls then authenticate transparently (a fresh session minted from the cert per
|
|
15
|
+
* request, the repo host resolved to its authority via RFC 9728). `token` hands
|
|
16
|
+
* out a session token on demand for any other use (a git credential file, an env
|
|
17
|
+
* var, CI).
|
|
18
|
+
*/
|
|
19
|
+
export declare function sessionCommand(): Command;
|