feat(yaiam): fetch an SSH certificate for a public key (yaiam ADR-0046)

Client.SSHCertificate trades an access token with the scope ssh and a
public key for a short-lived OpenSSH certificate at
<issuer>/ssh/certificate; SSHCAKeys reads the keys servers trust
(ca.pub, none on 404); SSHAudience names the audience yaiam wants.
Same rules as the other calls: https (http only to loopback), no
redirects, the token only in the Authorization header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-11-29 20:42:02 +01:00
1 parent c2a5e3928a
commit 0d062f559f
3 files changed
+210 -1

No files matched your search

+18 -1
View File
@@ -14,7 +14,7 @@ Today it holds the Atlassian clients that `yareco`, `yabaratla` and
| `atlassian/jira` | Jira REST API client (Cloud v3 and Server/Data Center v2) |
| `atlassian/confluence` | small Confluence REST API client (classic content API) |
| `atlassian/internal/transport` | the HTTP machinery both share; not importable from outside |
| `yaiam` | sign a command-line program in at yaiam (device flow, RFC 8628) and keep its tokens (YAIAM-710, 2026-11-09); sign a web application's users in (code flow with PKCE) and read users and groups from yaiam's admin API (2026-11-17); trade a user's token for one at another service, for an agent (token exchange, RFC 8693, 2026-11-21); refresh and revoke a web sign-in's tokens (2026-11-28) |
| `yaiam` | sign a command-line program in at yaiam (device flow, RFC 8628) and keep its tokens (YAIAM-710, 2026-11-09); sign a web application's users in (code flow with PKCE) and read users and groups from yaiam's admin API (2026-11-17); trade a user's token for one at another service, for an agent (token exchange, RFC 8693, 2026-11-21); refresh and revoke a web sign-in's tokens (2026-11-28); fetch an SSH certificate for a public key (ADR-0046, 2026-11-29) |
Standard library only, no third-party dependencies.
@@ -193,6 +193,23 @@ An example web application is yaiam's `examples/webapp`; an end-to-end
test against a real yaiam-authd is yaiam's
`internal/oidcprovider/weblogin_test.go`.
### SSH certificates
A tenant of yaiam can be an SSH certificate authority (yaiam ADR-0046).
Sign the user in with the scope `ssh` (the client needs it and the
audience `yaiam.SSHAudience(issuer)` in yaiam), then trade the access
token and a public key for a short-lived OpenSSH certificate:
```go
c := &yaiam.Client{Issuer: issuer, ClientID: id, Scopes: []string{"openid", yaiam.SSHScope}}
tok, err := c.Login(ctx, store, show) // or StartDevice/WaitDevice
cert, err := c.SSHCertificate(ctx, tok, publicKeyLine)
keys, err := c.SSHCAKeys(ctx) // what servers trust
```
Only the public key is sent. yaseva (`yaseva ssh login`) is the client
that keeps the private key in its vault.
### Acting for a user: token exchange
A confidential client that holds a user's access token -- an