Metadata-Version: 2.4
Name: civiwave-vineyard-id
Version: 0.1.0
Summary: DID authentication SDK for Civiwave — challenge-response, signature verification, JWT sessions
Project-URL: Homepage, https://github.com/civiwave/vineyard-id-py
Project-URL: Repository, https://github.com/civiwave/vineyard-id-py
Author-email: Civiwave <dev@civiwave.io>
License: MIT
Keywords: authentication,civiwave,did,identity,vineyard
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: pyjwt>=2.8.0
Requires-Dist: pynacl>=1.5.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# civiwave-vineyard-id (Python)

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

Equivalent to [`@civiwave/vineyard-id`](https://www.npmjs.com/package/@civiwave/vineyard-id) (npm).

## Install

```bash
pip install civiwave-vineyard-id
```

## Usage

```python
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](https://github.com/civiwave/civiwave/blob/main/docs/user-guide/developer/sdk.md).

## Development

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

## License

MIT
