ton-devtools-auth-sdk
Server-side TON Connect 2.0 proof verification for ICP-compatible services.
Part of the ton-devtools monorepo.
What it does
Implements the server-side authentication pipeline:
- §5.2 — TON proof message construction and ed25519 verification
- §5.3 — On-chain public key resolution via Toncenter API v2 (or TRMS)
- §5.6 — Single-use nonce management with TTL (replay attack prevention)
- §10.2 — Timestamp skew enforcement (±300 s)
Installation
pip install ton-devtools-auth-sdk
Quick Start
from ton_devtools_auth import ICPAuthenticator
auth = ICPAuthenticator(
rpc_base_url="https://toncenter.com/api/v2",
rpc_api_key="YOUR_KEY",
domain="id.yourapp.com",
)
# POST /auth/ton/connect
nonce = auth.issue_nonce() # store and return to client
# POST /auth/ton/verify
result = await auth.verify(
wallet_address=body.wallet_address,
nonce=body.nonce,
signature=body.signature,
public_key=body.public_key,
timestamp=body.timestamp,
domain=body.domain,
)
# result.wallet_address, result.public_key, result.on_chain_verified
Nonce storage backends
from ton_devtools_auth.nonce import NonceManager, InMemoryNonceStore
# Testing / single-replica
auth = ICPAuthenticator(nonce_store=InMemoryNonceStore())
# Production: bring your own Redis client
class RedisNonceStore:
def __init__(self, redis): self._r = redis
def set(self, key, value, ttl): self._r.set(key, value, ex=ttl)
def get(self, key): return self._r.get(key)
def delete(self, key): return bool(self._r.delete(key))
auth = ICPAuthenticator(nonce_store=RedisNonceStore(redis_client))
Pointing at TRMS for testing
auth = ICPAuthenticator(
rpc_base_url="http://localhost:8080", # ton-devtools-rpc-mock
domain="localhost",
)
License
MIT
Metadata
Release files for ton-devtools-auth-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ton_devtools_auth_sdk-0.1.0.tar.gz | 11.1 kB | Without provenance | Details for ton_devtools_auth_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ton_devtools_auth_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ton_devtools_auth_sdk-0.1.0-py3-none-any.whl |
Total release size: 23.8 kB
Release files / ton_devtools_auth_sdk-0.1.0.tar.gz
| Download URL | ton_devtools_auth_sdk-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea972915b619d257310a30dc377110526db020c26898370b01195a12bf956100
|
|
BLAKE2b-256 checksum How to use checksums |
c9b644e6a6f28f0c8e6d7344269d042d5799c3ed61a81966117916f0310385e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / ton_devtools_auth_sdk-0.1.0-py3-none-any.whl
| Download URL | ton_devtools_auth_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78b8d00eb15a5ae655b5047c17b6b5da97549c1798537bd50ae0e7a256347f2f
|
|
BLAKE2b-256 checksum How to use checksums |
d7ffc6ce5b792adab17f74f0b60b7d56426d3194a24af2fec9d3eae057fea9a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Security for ton-devtools-auth-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.