Documentation
¶
Overview ¶
Package brokered is the sealed answer of a sign-in the registry completes for a person's own machine: the tokens of a vendor whose token endpoint needs a client secret, which the registry adds to the exchange or the refresh and never keeps.
The machine makes a key pair for the one request and sends the public half with it. The registry's worker, which alone holds the secret, seals the tokens to that key with HPKE (RFC 9180), binding in what the request was for: the registry, the account, the kind of request and its id. The registry hands the sealed value over once and keeps nothing it can open; only the private half, which never leaves the machine and is used once, opens it, and only for that request.
Index ¶
Constants ¶
const ( // MaxPublicKey is the longest public key a request may carry. MaxPublicKey = 4096 // MaxTokens is the longest answer, as JSON, a seal carries. MaxTokens = 32 << 10 )
The bounds of a request and its answer.
const ( // KindConsent answers a sign-in: the tokens its exchange gave. KindConsent = "consent" // KindRefresh answers a refresh of a connection already made. KindRefresh = "refresh" )
The kinds of request an answer is for.
const Suite = "hpke-mlkem768x25519-hkdfsha256-chacha20poly1305"
Suite names the HPKE suite an answer is sealed with: ML-KEM-768 with X25519 (X-Wing), HKDF-SHA256 and ChaCha20-Poly1305.
Variables ¶
This section is empty.
Functions ¶
func CheckPublicKey ¶
CheckPublicKey reports whether publicKey is one of Suite's, for a registry to refuse a request it could never answer.
Types ¶
type Binding ¶
type Binding struct {
// Registry is the registry's origin.
Registry string `json:"registry"`
// Account is the account id the request was made as.
Account string `json:"account"`
// Kind is KindConsent or KindRefresh, and Request that request's id.
Kind string `json:"kind"`
Request string `json:"request"`
}
Binding is what one answer is for. Every field is bound into the seal.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is a machine's key pair for one request. Its private half stays in memory and is dropped after the one Open.
type Tokens ¶
type Tokens struct {
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken,omitempty"`
ExpiresAt time.Time `json:"expiresAt,omitzero"`
Scopes []string `json:"scopes,omitempty"`
// Issuer and ClientID are the authorization server and the
// deployment's client the tokens belong to.
Issuer string `json:"issuer"`
ClientID string `json:"clientId"`
}
Tokens is what an answer carries: the vendor's tokens, and the client they were made with, so the machine refreshes through the registry with the same one.