pypiapitoken

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2025 License: Apache-2.0, BSD-3-Clause Imports: 8 Imported by: 0

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

func NewDetector() veles.Detector

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL