Skip to main content

DID authentication SDK for Civiwave — challenge-response, signature verification, JWT sessions

Project description

civiwave-vineyard-id (Python)

DID authentication SDK for Civiwave applications — challenge-response, signature verification, JWT sessions.

Equivalent to @civiwave/vineyard-id (npm).

Install

pip install civiwave-vineyard-id

Usage

from civiwave_vineyard_id import (
    generate_challenge,
    verify_did_signature,
    issue_token,
    validate_token,
    DIDAuthRequest,
)

# Server: generate challenge for DID
challenge = generate_challenge("did:civiwave:5Grw...")

# Client signs challenge.message with their Ed25519 key, sends back:
request = DIDAuthRequest(
    did=challenge.did,
    nonce=challenge.nonce,
    signature="0xabc...",
    timestamp=challenge.timestamp,
    origin="https://app.civiwave.io",
)

# Server: verify signature
result = verify_did_signature(request, public_key_hex="0x...")
assert result.valid

# Server: issue JWT
token = issue_token(
    did="did:civiwave:5Grw...",
    ss58="5Grw...",
    tier="standard",
    secret="your-jwt-secret",
)

# Server/Edge: validate JWT
session = validate_token(token, secret="your-jwt-secret")
print(session.did, session.tier)

API

See the full API reference in SDK docs.

Development

pip install -e ".[dev]"
pytest
ruff check .
mypy civiwave_vineyard_id/

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

civiwave_vineyard_id-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

civiwave_vineyard_id-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: civiwave_vineyard_id-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for civiwave_vineyard_id-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5e8b2ba016feb99744089962d7f75ce43c4aeadb4bf9f2a69d4944512f0604da
MD5 c12b733710c76d2b6c9488b02221a3b1
BLAKE2b-256 6ca8ef5e4de560f3751b9f11634d894f49f0af7180f9d3453e7634e73364325e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for civiwave_vineyard_id-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a630fa642b2f43cf08efd1b040d7eefe00302b303a107a7647b738d22d357bc8
MD5 e5393e18715d897fbbc31ce808ba1fbb
BLAKE2b-256 ef7340422d9b888420f838a2ee1383c6594c9f8e80fcd276c05afc83ff7b68ad

See more details on using hashes here.

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