# GA4GH Passports v1 Quickstart

## Installation

```bash
pip install "ai4gh[passports]"
```

## Decode a Passport

```python
from ai4gh.specs.passports.models import Passport, Visa, VisaType

# Decode a GA4GH Passport JWT (without verification for inspection)
passport = Passport.from_jwt(jwt_token, verify=False)
print(f"Issuer: {passport.iss}")
print(f"Subject: {passport.sub}")

# Inspect visas
for visa in passport.ga4gh_passport_v1:
    print(f"  Visa type: {visa.type}")
    print(f"  Value: {visa.value}")
    print(f"  Source: {visa.source}")
```

## Validate a Visa

```python
from ai4gh.specs.passports.models import Visa, VisaType

# Check if a visa grants access
visa = Visa(
    type=VisaType.CONTROLLED_ACCESS_GRANTS,
    value="https://dac.example.org/datasets/DS001",
    source="https://login.example.org",
    asserted=1700000000,
    by="dac",
)

print(f"Access grant: {visa.value}")
print(f"Asserted by: {visa.by}")
```

## MCP Tool

```json
{
  "tool": "passport_decode",
  "arguments": {
    "jwt": "eyJhbGciOiJSUzI1NiIs..."
  }
}
```

## Visa Types

| Type | Description |
|------|-------------|
| `AffiliationAndRole` | Institutional affiliation |
| `AcceptedTermsAndPolicies` | Policy acceptance |
| `ResearcherStatus` | Bona fide researcher status |
| `ControlledAccessGrants` | Dataset access grants |
| `LinkedIdentities` | Cross-platform identity links |

## Data Models

```python
from ai4gh.specs.passports.models import Passport, Visa, VisaType
```
