Documentation
¶
Overview ¶
Package pypiapitoken contains a Veles Secret type and a Detector for PyPI API Tokens (prefix `pypi-`).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDetector ¶
NewDetector returns a new simpletoken.Detector that matches PyPI API Tokens.
func NewValidator ¶
func NewValidator() *simplevalidate.Validator[PyPIAPIToken]
NewValidator creates a new Validator that validates PyPI API Tokens by attempting to upload a dummy package to PyPI. It performs a POST request to the PyPI legacy upload URL with multipart form data using the API token in the Authorization header. If the request returns HTTP 400 Bad Request, the key is considered valid. If HTTP 403 Forbidden, the key is considered invalid. Other errors return ValidationFailed. We send an invalid package to not add any new package to the account.
Types ¶
type PyPIAPIToken ¶
type PyPIAPIToken struct {
Token string
}
PyPIAPIToken is a Veles Secret that holds relevant information for a PyPI API Tokens (prefix `pypi-`). PyPIAPIToken represents an API Token used to authenticate requests