Documentation
¶
Index ¶
- Constants
- Variables
- func WithAccountID(ctx context.Context, id string) context.Context
- func WithOrderID(ctx context.Context, id string) context.Context
- type Account
- type AccountRequest
- type AttestationObject
- type AttestationStatement
- type AttestationVerifier
- type Authorization
- type Authorizer
- type CA
- type Certificate
- type CertificateIssuer
- type Challenge
- type ChallengeRequest
- type ContextHandler
- type DeviceInfo
- type Directory
- type FinalizeRequest
- type HardwareModule
- type Identifier
- type IssuanceEvent
- type IssuanceObserver
- type Meta
- type Nonce
- type NonceValidationError
- type Option
- type Order
- type OrderRequest
- type PermanentIdentifier
- type Problem
- func AccountDoesNotExist(detail string) *Problem
- func BadCSR(detail string) *Problem
- func BadNonce(detail string) *Problem
- func BadSignatureAlgorithm(detail string, supportedAlgorithms []string) *Problem
- func InternalServerError(detail string) *Problem
- func InvalidContact(detail string) *Problem
- func Malformed(detail string) *Problem
- func MethodNotAllowed(detail string) *Problem
- func RequestTooLarge(detail string) *Problem
- func Unauthorized(detail string) *Problem
- func UnsupportedMediaTypeProblem(detail string) *Problem
- type Storage
Constants ¶
const ( OrderStatusPending = "pending" OrderStatusReady = "ready" OrderStatusProcessing = "processing" OrderStatusValid = "valid" OrderStatusInvalid = "invalid" )
const ( IdentifierTypePermanentIdentifier = "permanent-identifier" IdentifierTypeHardwareModule = "hardware-module" )
const ( AuthzStatusPending = "pending" AuthzStatusValid = "valid" AuthzStatusInvalid = "invalid" AuthzStatusExpired = "expired" )
const ( ChallengeStatusPending = "pending" ChallengeStatusProcessing = "processing" ChallengeStatusValid = "valid" ChallengeStatusInvalid = "invalid" )
const (
// ACMEProblemTypePrefix is the URN prefix for ACME error types
ACMEProblemTypePrefix = "urn:ietf:params:acme:error:"
)
const (
ChallengeTypeDeviceAttest01 = "device-attest-01"
)
Variables ¶
var ( ErrNonceNotFound = errors.New("nonce not found") ErrNonceExpired = errors.New("nonce expired") )
Functions ¶
Types ¶
type Account ¶
type Account struct {
ID string `json:"id"` // Include in storage
Key *jose.JSONWebKey `json:"key,omitempty"` // Include in storage
KeyBytes []byte `json:"keyBytes,omitempty"` // Include in storage
Status string `json:"status"`
Contact []string `json:"contact,omitempty"`
TermsOfServiceAgreed bool `json:"termsOfServiceAgreed,omitempty"`
Orders string `json:"orders,omitempty"`
CreatedAt time.Time `json:"createdAt"` // Include in storage
}
type AccountRequest ¶
type AttestationObject ¶
type AttestationObject struct {
Format string `json:"fmt" cbor:"fmt"`
AttStmt map[string]any `json:"attStmt" cbor:"attStmt"`
}
AttestationObject represents an ACME Device Attestation object Based on WebAuthn attestation object but simplified for ACME use case Uses CBOR encoding as per WebAuthn specification
type AttestationStatement ¶
type AttestationVerifier ¶
type AttestationVerifier interface {
Format() string
Verify(ctx context.Context, stmt AttestationStatement, challenge []byte) (*DeviceInfo, error)
}
type Authorization ¶
type Authorization struct {
ID string `json:"id"`
Status string `json:"status"`
Expires *time.Time `json:"expires,omitempty"`
Identifier Identifier `json:"identifier"`
Challenges []Challenge `json:"challenges"`
Wildcard bool `json:"wildcard,omitempty"`
AccountID string `json:"accountId"`
OrderID string `json:"orderId"`
CreatedAt time.Time `json:"createdAt"`
}
type Authorizer ¶
type Authorizer interface {
Authorize(ctx context.Context, device *DeviceInfo) (bool, error)
}
type CA ¶
type CA struct {
// contains filtered or unexported fields
}
type Certificate ¶
type Certificate struct {
*x509.Certificate `json:"-"`
Raw []byte `json:"raw"`
SerialNumber string `json:"serialNumber"`
Chain []*x509.Certificate `json:"-"`
ChainRaw [][]byte `json:"chainRaw,omitempty"`
}
Certificate holds an issued certificate and its optional chain.
ChainRaw is the authoritative representation of the chain and is persisted to storage. Chain is a convenience field populated at issuance time but is NOT reconstituted after a storage round-trip (JSON tags exclude it). Code that consumes certificates retrieved from storage must use ChainRaw.
type CertificateIssuer ¶
type CertificateIssuer interface {
// The deviceInfos slice contains attestation-derived device information.
IssueCertificate(csr *x509.CertificateRequest, deviceInfos []*DeviceInfo) (*Certificate, error)
}
type Challenge ¶
type Challenge struct {
Type string `json:"type"`
URL string `json:"url"`
Status string `json:"status"`
Validated *time.Time `json:"validated,omitempty"`
Error *Problem `json:"error,omitempty"`
Token string `json:"token"`
KeyAuth string `json:"keyAuthorization,omitempty"`
ID string `json:"id"`
AuthzID string `json:"authzId"`
CreatedAt time.Time `json:"createdAt"`
// Device attestation specific fields
Attestation map[string]any `json:"attestation,omitempty"`
}
type ChallengeRequest ¶
type ChallengeRequest struct {
// AttObj contains the base64url-encoded WebAuthn attestation object
// as specified in draft-ietf-acme-device-attest-01
AttObj string `json:"attObj"`
}
type ContextHandler ¶
type ContextHandler struct {
// contains filtered or unexported fields
}
func NewContextHandler ¶
func NewContextHandler(inner slog.Handler) *ContextHandler
type DeviceInfo ¶
type DeviceInfo struct {
// ACME draft specification identifiers - these map to ACME identifier types
PermanentIdentifier *PermanentIdentifier
HardwareModule *HardwareModule
}
DeviceInfo contains extracted device information from attestation
This structure follows the ACME Device Attestation draft specification. PermanentIdentifier contains device serial numbers or similar persistent identifiers. HardwareModule contains hardware-specific identifiers like UDIDs or TPM data.
type FinalizeRequest ¶
type FinalizeRequest struct {
CSR string `json:"csr"`
}
type HardwareModule ¶
type HardwareModule struct {
Type asn1.ObjectIdentifier
Value []byte
}
HardwareModule represents a hardware-module name as defined in RFC 4108.
HardwareModuleName ::= SEQUENCE {
hwType OBJECT IDENTIFIER,
hwSerialNum OCTET STRING
}
type Identifier ¶
type IssuanceEvent ¶
type IssuanceEvent struct {
Timestamp time.Time
DeviceInfo *DeviceInfo
Attestation *AttestationStatement
Certificate *Certificate
AccountID string
OrderID string
Metadata map[string]any
}
IssuanceEvent represents a certificate issuance event
type IssuanceObserver ¶
type IssuanceObserver interface {
OnIssuance(ctx context.Context, event *IssuanceEvent) error
}
IssuanceObserver handles actions after certificate issuance (logging, inventory updates, etc.)
type NonceValidationError ¶
type NonceValidationError struct {
Err error
}
func (*NonceValidationError) Error ¶
func (e *NonceValidationError) Error() string
func (*NonceValidationError) Is ¶
func (e *NonceValidationError) Is(target error) bool
func (*NonceValidationError) Unwrap ¶
func (e *NonceValidationError) Unwrap() error
type Option ¶
type Option func(*CA)
func WithObserver ¶
func WithObserver(obs IssuanceObserver) Option
func WithPrefix ¶
func WithVerifier ¶
func WithVerifier(v AttestationVerifier) Option
type Order ¶
type Order struct {
ID string `json:"id"`
Status string `json:"status"`
Expires *time.Time `json:"expires,omitempty"`
Identifiers []Identifier `json:"identifiers"`
NotBefore *time.Time `json:"notBefore,omitempty"`
NotAfter *time.Time `json:"notAfter,omitempty"`
Error *Problem `json:"error,omitempty"`
Authorizations []string `json:"authorizations"`
Finalize string `json:"finalize"`
Certificate string `json:"certificate,omitempty"`
AccountID string `json:"accountId"`
CreatedAt time.Time `json:"createdAt"`
}
type OrderRequest ¶
type OrderRequest struct {
Identifiers []Identifier `json:"identifiers"`
NotBefore *time.Time `json:"notBefore,omitempty"`
NotAfter *time.Time `json:"notAfter,omitempty"`
}
type PermanentIdentifier ¶
type PermanentIdentifier struct {
Identifier string
Assigner asn1.ObjectIdentifier
}
PermanentIdentifier represents a permanent-identifier as defined in RFC 4043.
PermanentIdentifier ::= SEQUENCE {
identifierValue UTF8String OPTIONAL,
assigner OBJECT IDENTIFIER OPTIONAL
}
type Problem ¶
type Problem struct {
// Type contains a URI reference that identifies the problem type
Type string `json:"type,omitempty"`
// Title is a short, human-readable summary of the problem type
Title string `json:"title,omitempty"`
// Status is the HTTP status code
Status int `json:"status,omitempty"`
// Detail is a human-readable explanation specific to this occurrence
Detail string `json:"detail,omitempty"`
// Instance is a URI reference that identifies the specific occurrence
Instance string `json:"instance,omitempty"`
// Identifier is the ACME identifier this problem relates to (for subproblems)
Identifier *Identifier `json:"identifier,omitempty"`
// Subproblems contains an array of sub-problems for compound errors
Subproblems []Problem `json:"subproblems,omitempty"`
// RFC 8555 Section 6.2: "The problem document returned with the error MUST include an
// 'algorithms' field with an array of supported 'alg' values."
Algorithms []string `json:"algorithms,omitempty"`
}
Problem represents an RFC 7807/9457 compliant problem details object It implements the error interface
func AccountDoesNotExist ¶
func BadSignatureAlgorithm ¶
func InternalServerError ¶
func InvalidContact ¶
func MethodNotAllowed ¶
func RequestTooLarge ¶
func Unauthorized ¶
type Storage ¶
type Storage interface {
CreateNonce(ctx context.Context, nonce *Nonce) error
ConsumeNonce(ctx context.Context, value string, expiry time.Duration) (*Nonce, error)
CreateAccount(ctx context.Context, account *Account) error
GetAccount(ctx context.Context, id string) (*Account, error)
GetAccountByKey(ctx context.Context, keyThumbprint string) (*Account, error)
UpdateAccount(ctx context.Context, account *Account) error
CreateOrder(ctx context.Context, order *Order) error
GetOrder(ctx context.Context, id string) (*Order, error)
UpdateOrder(ctx context.Context, order *Order) error
GetOrdersByAccount(ctx context.Context, accountID string) ([]*Order, error)
CreateAuthorization(ctx context.Context, authz *Authorization) error
GetAuthorization(ctx context.Context, id string) (*Authorization, error)
UpdateAuthorization(ctx context.Context, authz *Authorization) error
CreateChallenge(ctx context.Context, challenge *Challenge) error
GetChallenge(ctx context.Context, id string) (*Challenge, error)
SetChallengeProcessing(ctx context.Context, id string) error
SetChallengeValid(ctx context.Context, id string, validated time.Time, attestation map[string]any) error
SetChallengeInvalid(ctx context.Context, id string, validated time.Time, problem *Problem) error
CreateCertificate(ctx context.Context, cert *Certificate) error
GetCertificate(ctx context.Context, id string) (*Certificate, error)
Close() error
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
authorizers
|
|
|
Package certutil provides ASN.1/X.509 certificate extension utilities for building SubjectAltName extensions with PermanentIdentifier (RFC 4043) and HardwareModuleName (RFC 4108) otherName entries.
|
Package certutil provides ASN.1/X.509 certificate extension utilities for building SubjectAltName extensions with PermanentIdentifier (RFC 4043) and HardwareModuleName (RFC 4108) otherName entries. |
|
issuers
|
|
|
observers
|
|
|
stderr
Package stderr provides an issuance observer that logs certificate issuance events to stderr.
|
Package stderr provides an issuance observer that logs certificate issuance events to stderr. |
|
signers
|
|
|
remote
Package remote provides a crypto.Signer implementation that delegates signing operations to an authenticated HTTP signing oracle.
|
Package remote provides a crypto.Signer implementation that delegates signing operations to an authenticated HTTP signing oracle. |
|
storage
|
|
|
verifiers
|
|