Skip to main content

Embeddable auth server module for the pico ecosystem — JWT issuance, wallet login, JWKS endpoint

Project description

pico-server-auth

PyPI Ask DeepWiki License: MIT CI codecov Quality Gate Status Duplicated Lines (%) Maintainability Rating PyPI Downloads Docs Interactive Lab

Embeddable auth server module for the pico-boot ecosystem.

Issues JWT tokens, handles wallet challenge-response login, and exposes JWKS — all compatible with pico-client-auth validation.

Two deployment modes

Embedded — add to any pico-boot app, auth runs in the same process:

container = init(modules=["myapp", "pico_server_auth"], config=config)
# /auth/jwks, /auth/challenge, /auth/wallet, /auth/login — all available
# pico-client-auth validates tokens from the same JWKS

Standalone — deploy as a separate auth service (like pico-auth):

container = init(modules=["pico_server_auth"], config=config)
app = container.get(FastAPI)
# Other services point pico-client-auth JWKS to this service's /auth/jwks

Endpoints

GET  /auth/jwks           JWKS public keys (pico-client-auth fetches this)
POST /auth/challenge      Request nonce for wallet login
POST /auth/wallet         Verify wallet signature, issue JWT
POST /auth/login          Password login (admin bootstrap)

Wallet login flow

Client                    pico-server-auth
  │                            │
  │ POST /auth/challenge       │
  │ { address: "0x..." }       │
  │───────────────────────────>│
  │ { challenge: "<nonce>" }   │
  │<───────────────────────────│
  │                            │
  │ sign(nonce) with wallet    │
  │                            │
  │ POST /auth/wallet          │
  │ { address, public_key,     │
  │   signature, challenge,    │
  │   algorithm: "ML-DSA-65" } │
  │───────────────────────────>│
  │ { access_token, address }  │
  │<───────────────────────────│

Supported wallet algorithms

Algorithm Type Library
ML-DSA-65 Post-quantum lattice (FIPS 204) cryptography
Ed25519 Edwards curve cryptography
secp256k1 Elliptic curve (ECDSA) cryptography

Compatibility with pico-client-auth

Tokens issued by pico-server-auth are standard JWT (RS256). pico-client-auth validates them by fetching JWKS from the /auth/jwks endpoint.

Same process: pico-client-auth discovers the JWKS endpoint automatically (same FastAPI app).

Separate processes: configure pico-client-auth to point to the server:

auth_client:
  issuer: "http://auth-server:8100"
  audience: "pico"
  # JWKS fetched from http://auth-server:8100/auth/jwks

Challenge store

By default, challenges are stored in memory with TTL expiry. For multi-instance deployments, register a custom ChallengeStore component:

@component
class RedisChallengeStore:
    async def create(self, address: str) -> str: ...
    async def validate(self, address: str, nonce: str) -> bool: ...
    async def cleanup(self) -> int: ...

The in-memory default is replaced automatically via on_missing_selector.

Configuration

server_auth:
  issuer: "http://localhost:8100"
  audience: "pico"
  algorithm: "RS256"
  access_token_expire_minutes: 15
  challenge_ttl_seconds: 60
  supported_wallet_algorithms:
    - "ML-DSA-65"
    - "Ed25519"
    - "secp256k1"

Stack

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pico_server_auth-0.1.0.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pico_server_auth-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file pico_server_auth-0.1.0.tar.gz.

File metadata

  • Download URL: pico_server_auth-0.1.0.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pico_server_auth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cdf8d9bfd64cb8282b8a280a62f23b845f617830dceda10aab2c13c6fa4d3ea7
MD5 1e76a3ba153235e9ce50fe0c0fb85b21
BLAKE2b-256 5683fd3d4dfb2ddecd7e722bad8e42d6ca009d4b4b854a98a3f0ee3dfea3e41a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_server_auth-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-server-auth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pico_server_auth-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pico_server_auth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a0b3ee8366477635aa78908fcc09ad6e63a23ac543f4f62a48e6e686cca4127
MD5 97968c76bb1050f87cadf1d2d366d98a
BLAKE2b-256 b1db13c64cc036adfd5e0993d2c61ba0656a71477d8e2609be194c2b259b029e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_server_auth-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-server-auth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page