Skip to main content

Nexus SDK for Python — auth verification and mail API for VYLTH services

Project description

nexus-vylth

Nexus SDK for Python — auth verification and mail API for VYLTH services.

Install

# Mail only
pip install nexus-vylth

# Mail + Auth (JWT verification)
pip install nexus-vylth[auth]

# Everything
pip install nexus-vylth[all]

Mail API

Send emails via your Nexus Mail API key (nm_...):

from nexus_vylth import NexusMail

mail = NexusMail("nm_your_key_here")

# Single send
result = mail.send(
    to="user@example.com",
    subject="Hello",
    body_text="Hi there!",
)
print(result.from_address)  # you@vylth.com

# Batch send
results = mail.send_batch(
    recipients=["alice@example.com", "bob@example.com"],
    subject="Newsletter",
    body_html="<h1>Monthly Update</h1><p>Here's what happened...</p>",
)

Auth (JWT Verification)

Verify Nexus access tokens using JWKS (auto-fetched and cached):

from nexus_vylth import NexusAuth

auth = NexusAuth()

claims = auth.verify(token)
print(claims.email)         # user@vylth.com
print(claims.global_role)   # executor
print(claims.has_role("commander"))  # True

FastAPI

from fastapi import FastAPI, Depends
from nexus_vylth import NexusAuth

app = FastAPI()
auth = NexusAuth()

@app.get("/profile")
async def profile(claims=Depends(auth.fastapi_dependency())):
    return {"email": claims.email, "role": claims.global_role}

@app.get("/admin")
async def admin(claims=Depends(auth.fastapi_dependency("commander"))):
    return {"admin": claims.username}

Flask

from flask import Flask, g, jsonify
from nexus_vylth import NexusAuth

app = Flask(__name__)
auth = NexusAuth()

@app.route("/profile")
@auth.flask_decorator()
def profile():
    return jsonify({"email": g.nexus_claims.email})

@app.route("/admin")
@auth.flask_decorator("commander")
def admin():
    return jsonify({"admin": g.nexus_claims.username})

Claims Fields

Field Type Description
sub str Account ID
email str Primary email
username str Username
avatar str Avatar URL
global_role str Global role (citizen/pioneer/navigator/commander/executor)
email_verified bool Whether email is verified
affiliate_code str Referral code
app_roles dict Per-app role overrides
two_factor_verified bool Whether 2FA was verified this session

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

nexus_vylth-1.0.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

nexus_vylth-1.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file nexus_vylth-1.0.1.tar.gz.

File metadata

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

File hashes

Hashes for nexus_vylth-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0e59e58619cc05d7a39288d7e697cd06068f096341b43d7c02d6accff641b092
MD5 b6a488625efcb2e1f6fa23cebe7d8897
BLAKE2b-256 bed5f22cb49c59bf9923c240b01c7694b22963e5a1821fbb5aee8011388b04d5

See more details on using hashes here.

File details

Details for the file nexus_vylth-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: nexus_vylth-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nexus_vylth-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f48659c3ff8985b0e6c6dd2e22cb01b894afdb69e7577efcd876b3505435562
MD5 67eaa11bd8fa2ddf672435ccb08e589a
BLAKE2b-256 a2db5af3b1ee7220378dc3f2d9e0106ab545858a50258c2e4f7ee5c610f37046

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