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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file civiwave_vineyard_id-0.2.0.tar.gz.
File metadata
- Download URL: civiwave_vineyard_id-0.2.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55c7c877341e220d90e42a4b7f6417ef78fa798c1bb2604167e0a61cdb478bf3
|
|
| MD5 |
b2a96c72b444eca49f7252473889ae7a
|
|
| BLAKE2b-256 |
b2812c4b01961ada648f83bd85159d36aef4fd49fb72748327e4e6b8f4e3c236
|
File details
Details for the file civiwave_vineyard_id-0.2.0-py3-none-any.whl.
File metadata
- Download URL: civiwave_vineyard_id-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a4ec11eaac9aaff24bab3b727f379f75984296afadba926767a42cc2766e389
|
|
| MD5 |
1a7ce8fefb301a2223a2ca65403fe1b9
|
|
| BLAKE2b-256 |
0663544dc0c57cc127364559d487a6ffae46bc26f20462514c506dc9cac677fa
|