quantumsafe 1.0.0__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. quantumsafe-2.0.0/CHANGELOG.md +14 -0
  2. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/LICENSE +0 -0
  3. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/MANIFEST.in +1 -0
  4. quantumsafe-2.0.0/PKG-INFO +88 -0
  5. quantumsafe-2.0.0/README.md +57 -0
  6. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/pyproject.toml +8 -3
  7. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe/__init__.py +12 -0
  8. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe/client.py +0 -0
  9. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe/modules/__init__.py +0 -0
  10. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe/modules/keys.py +2 -2
  11. quantumsafe-2.0.0/quantumsafe/modules/scan.py +125 -0
  12. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe/modules/sign.py +0 -0
  13. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe/modules/verify.py +0 -0
  14. quantumsafe-2.0.0/quantumsafe/py.typed +1 -0
  15. quantumsafe-2.0.0/quantumsafe/types.py +151 -0
  16. quantumsafe-2.0.0/quantumsafe.egg-info/PKG-INFO +88 -0
  17. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe.egg-info/SOURCES.txt +2 -0
  18. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe.egg-info/requires.txt +1 -1
  19. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/setup.cfg +4 -4
  20. quantumsafe-1.0.0/PKG-INFO +0 -85
  21. quantumsafe-1.0.0/README.md +0 -56
  22. quantumsafe-1.0.0/quantumsafe/modules/scan.py +0 -76
  23. quantumsafe-1.0.0/quantumsafe/types.py +0 -98
  24. quantumsafe-1.0.0/quantumsafe.egg-info/PKG-INFO +0 -85
  25. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe.egg-info/dependency_links.txt +0 -0
  26. {quantumsafe-1.0.0 → quantumsafe-2.0.0}/quantumsafe.egg-info/top_level.txt +0 -0
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0 — 2026-11-30
4
+
5
+ ### Breaking changes
6
+ - `ScanResult.address_risk_score` and `address_risk_grade` are `None` when an address cannot be scored (for example non-wallet accounts).
7
+ - Requires `pqcrypto>=1.0.0,<2.0.0` (SLH-DSA uses the `slh_dsa_sha2_128s` module and the new `keygen()` API).
8
+
9
+ ### Added
10
+ - `scan.wallet()` accepts all 19 supported chains (`ScanChain`) and returns public key status, history coverage, token availability, account type, exposed transactions (`ExposedTransaction`) and comparison stats (`ComparisonStats`).
11
+ - Ships `py.typed` for type checkers.
12
+
13
+ ## 1.0.1 — 2026-04-06
14
+ - Initial release.
File without changes
@@ -1,3 +1,4 @@
1
1
  include LICENSE
2
2
  include README.md
3
+ include CHANGELOG.md
3
4
  recursive-exclude tests *
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantumsafe
3
+ Version: 2.0.0
4
+ Summary: QuantumSafe — Post-quantum cryptography SDK for blockchain
5
+ License: MIT
6
+ Project-URL: Homepage, https://qsafe.dev
7
+ Project-URL: Documentation, https://docs.qsafe.dev
8
+ Project-URL: Repository, https://github.com/qshield-xyz/quantumsafe-python-sdk
9
+ Project-URL: Issues, https://github.com/qshield-xyz/quantumsafe-python-sdk/issues
10
+ Project-URL: Changelog, https://github.com/qshield-xyz/quantumsafe-python-sdk/blob/main/CHANGELOG.md
11
+ Keywords: quantum,pqc,blockchain,ml-dsa,post-quantum,cryptography,ethereum,solana,bitcoin
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Security :: Cryptography
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx>=0.27.0
24
+ Requires-Dist: pqcrypto<2.0.0,>=1.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8.0; extra == "dev"
27
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
28
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
29
+ Requires-Dist: respx>=0.21.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # quantumsafe
33
+
34
+ Post-quantum cryptography SDK for blockchain. Scan wallets for quantum risk, generate PQC keys, and verify PQC signatures.
35
+
36
+ Docs: [docs.qsafe.dev](https://docs.qsafe.dev) · Issues: [GitHub](https://github.com/qshield-xyz/quantumsafe-python-sdk/issues) · [Changelog](CHANGELOG.md)
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install quantumsafe
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ Set `QSAFE_API_KEY` to your server-side secret API key. Generate a local key pair, register the public key and verify a PQC signature over a message.
47
+
48
+ ```python
49
+ import os
50
+ from pqcrypto.sign import ml_dsa_65
51
+ from quantumsafe import QuantumSafe
52
+
53
+ with QuantumSafe(api_key=os.environ["QSAFE_API_KEY"]) as qs:
54
+ keypair = qs.keys.generate(algorithm="ml-dsa-65")
55
+ qs.keys.register(public_key=keypair.public_key, chain="ethereum")
56
+ message = bytes.fromhex("deadbeef")
57
+ signature = ml_dsa_65.sign(bytes.fromhex(keypair.private_key), message)
58
+ result = qs.verify(public_key=keypair.public_key, message=message.hex(), signature=signature.hex())
59
+ print(result.valid)
60
+ ```
61
+
62
+ In the updated SDK source, set `QSAFE_ADDRESS` to an address on the chain you want to scan.
63
+
64
+ ```python
65
+ with QuantumSafe(api_key=os.environ["QSAFE_API_KEY"]) as qs:
66
+ scan = qs.scan.wallet(chain="bitcoin", address=os.environ["QSAFE_ADDRESS"])
67
+ print(scan.methodology_version, scan.public_key_status, scan.history_status)
68
+ if scan.address_risk_score is not None:
69
+ print(scan.address_risk_score, scan.address_risk_grade)
70
+ if scan.token_data_unavailable:
71
+ print("Token data unavailable")
72
+ for tx in scan.exposed_transactions or []:
73
+ print(tx.hash, tx.explorer_url)
74
+ ```
75
+
76
+ ## Supported Chains
77
+
78
+ Wallet scans support `ethereum`, `base`, `arbitrum`, `polygon`, `linea`, `scroll`, `gnosis`, `celo`, `mantle`, `blast`, `optimism`, `bsc`, `avalanche`, `sonic`, `zksync`, `solana`, `bitcoin`, `cosmos`, and `tron`. The exported `ScanChain` type lists these values. Key registration and hybrid signing support `ethereum`, `base`, and `arbitrum`.
79
+
80
+ `history_status` reports `complete`, `limited`, or `unavailable`. `public_key_status` reports `exposed`, `safe`, or `unknown`. A scan can include transaction evidence even with limited history. An unavailable score and grade are `None`; a measured zero is returned as `0`. Older responses that omit the coverage fields return `None` for those fields.
81
+
82
+ ## Documentation
83
+
84
+ Full API docs: [https://docs.qsafe.dev](https://docs.qsafe.dev)
85
+
86
+ ## License
87
+
88
+ MIT — see [LICENSE](./LICENSE)
@@ -0,0 +1,57 @@
1
+ # quantumsafe
2
+
3
+ Post-quantum cryptography SDK for blockchain. Scan wallets for quantum risk, generate PQC keys, and verify PQC signatures.
4
+
5
+ Docs: [docs.qsafe.dev](https://docs.qsafe.dev) · Issues: [GitHub](https://github.com/qshield-xyz/quantumsafe-python-sdk/issues) · [Changelog](CHANGELOG.md)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install quantumsafe
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ Set `QSAFE_API_KEY` to your server-side secret API key. Generate a local key pair, register the public key and verify a PQC signature over a message.
16
+
17
+ ```python
18
+ import os
19
+ from pqcrypto.sign import ml_dsa_65
20
+ from quantumsafe import QuantumSafe
21
+
22
+ with QuantumSafe(api_key=os.environ["QSAFE_API_KEY"]) as qs:
23
+ keypair = qs.keys.generate(algorithm="ml-dsa-65")
24
+ qs.keys.register(public_key=keypair.public_key, chain="ethereum")
25
+ message = bytes.fromhex("deadbeef")
26
+ signature = ml_dsa_65.sign(bytes.fromhex(keypair.private_key), message)
27
+ result = qs.verify(public_key=keypair.public_key, message=message.hex(), signature=signature.hex())
28
+ print(result.valid)
29
+ ```
30
+
31
+ In the updated SDK source, set `QSAFE_ADDRESS` to an address on the chain you want to scan.
32
+
33
+ ```python
34
+ with QuantumSafe(api_key=os.environ["QSAFE_API_KEY"]) as qs:
35
+ scan = qs.scan.wallet(chain="bitcoin", address=os.environ["QSAFE_ADDRESS"])
36
+ print(scan.methodology_version, scan.public_key_status, scan.history_status)
37
+ if scan.address_risk_score is not None:
38
+ print(scan.address_risk_score, scan.address_risk_grade)
39
+ if scan.token_data_unavailable:
40
+ print("Token data unavailable")
41
+ for tx in scan.exposed_transactions or []:
42
+ print(tx.hash, tx.explorer_url)
43
+ ```
44
+
45
+ ## Supported Chains
46
+
47
+ Wallet scans support `ethereum`, `base`, `arbitrum`, `polygon`, `linea`, `scroll`, `gnosis`, `celo`, `mantle`, `blast`, `optimism`, `bsc`, `avalanche`, `sonic`, `zksync`, `solana`, `bitcoin`, `cosmos`, and `tron`. The exported `ScanChain` type lists these values. Key registration and hybrid signing support `ethereum`, `base`, and `arbitrum`.
48
+
49
+ `history_status` reports `complete`, `limited`, or `unavailable`. `public_key_status` reports `exposed`, `safe`, or `unknown`. A scan can include transaction evidence even with limited history. An unavailable score and grade are `None`; a measured zero is returned as `0`. Older responses that omit the coverage fields return `None` for those fields.
50
+
51
+ ## Documentation
52
+
53
+ Full API docs: [https://docs.qsafe.dev](https://docs.qsafe.dev)
54
+
55
+ ## License
56
+
57
+ MIT — see [LICENSE](./LICENSE)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quantumsafe"
7
- version = "1.0.0"
7
+ version = "2.0.0"
8
8
  description = "QuantumSafe — Post-quantum cryptography SDK for blockchain"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -22,13 +22,15 @@ classifiers = [
22
22
  ]
23
23
  dependencies = [
24
24
  "httpx>=0.27.0",
25
- "pqcrypto>=0.1.0",
25
+ "pqcrypto>=1.0.0,<2.0.0",
26
26
  ]
27
27
 
28
28
  [project.urls]
29
29
  Homepage = "https://qsafe.dev"
30
30
  Documentation = "https://docs.qsafe.dev"
31
- Repository = "https://github.com/quantumsafe/sdk"
31
+ Repository = "https://github.com/qshield-xyz/quantumsafe-python-sdk"
32
+ Issues = "https://github.com/qshield-xyz/quantumsafe-python-sdk/issues"
33
+ Changelog = "https://github.com/qshield-xyz/quantumsafe-python-sdk/blob/main/CHANGELOG.md"
32
34
 
33
35
  [project.optional-dependencies]
34
36
  dev = [
@@ -41,6 +43,9 @@ dev = [
41
43
  [tool.setuptools.packages.find]
42
44
  include = ["quantumsafe*"]
43
45
 
46
+ [tool.setuptools.package-data]
47
+ quantumsafe = ["py.typed"]
48
+
44
49
  [tool.ruff]
45
50
  target-version = "py310"
46
51
  line-length = 100
@@ -6,8 +6,14 @@ from quantumsafe.types import (
6
6
  Algorithm,
7
7
  Attestation,
8
8
  Chain,
9
+ ComparisonStats,
10
+ ExposedTransaction,
11
+ HistoryStatus,
9
12
  KeyPair,
13
+ PublicKeyStatus,
10
14
  RegisteredKey,
15
+ ScanAccountType,
16
+ ScanChain,
11
17
  ScanResult,
12
18
  VerifyResult,
13
19
  )
@@ -18,6 +24,12 @@ __all__ = [
18
24
  "QuantumSafe",
19
25
  "Algorithm",
20
26
  "Chain",
27
+ "ScanChain",
28
+ "ScanAccountType",
29
+ "PublicKeyStatus",
30
+ "HistoryStatus",
31
+ "ExposedTransaction",
32
+ "ComparisonStats",
21
33
  "KeyPair",
22
34
  "RegisteredKey",
23
35
  "Attestation",
@@ -43,7 +43,7 @@ ALGORITHM_INFO: dict[str, AlgorithmInfo] = {
43
43
  public_key_size=32,
44
44
  secret_key_size=64,
45
45
  signature_size=7856,
46
- pqcrypto_module="pqcrypto.sign.sphincs_sha2_128s_simple",
46
+ pqcrypto_module="pqcrypto.sign.slh_dsa_sha2_128s",
47
47
  ),
48
48
  }
49
49
 
@@ -97,7 +97,7 @@ class KeysModule:
97
97
 
98
98
  # pqcrypto로 실 PQC 키 생성
99
99
  mod = _get_pqc_module(algorithm)
100
- pk, sk = mod.generate_keypair()
100
+ pk, sk = mod.keygen()
101
101
 
102
102
  return KeyPair(
103
103
  public_key=pk.hex(),
@@ -0,0 +1,125 @@
1
+ # SECURITY: Only use secrets/os.urandom for randomness. Never import random.
2
+ """지갑 양자 위협 스캔 모듈"""
3
+
4
+ from __future__ import annotations
5
+
6
+ import logging
7
+ from typing import TYPE_CHECKING
8
+
9
+ from quantumsafe.types import (
10
+ ChainFactor,
11
+ ComparisonStats,
12
+ ExposedTransaction,
13
+ RiskFactor,
14
+ ScanChain,
15
+ ScanResult,
16
+ )
17
+
18
+ if TYPE_CHECKING:
19
+ from quantumsafe.client import QuantumSafe
20
+
21
+ logger = logging.getLogger("quantumsafe.scan")
22
+
23
+
24
+ class ScanModule:
25
+ """지갑 양자 위협 스캔 모듈"""
26
+
27
+ def __init__(self, client: QuantumSafe) -> None:
28
+ self._client = client
29
+
30
+ def wallet(
31
+ self,
32
+ address: str,
33
+ chain: ScanChain | str = "ethereum",
34
+ ) -> ScanResult:
35
+ """지갑 양자 위협 스캔
36
+
37
+ Args:
38
+ address: 해당 체인 형식의 지갑 주소
39
+ chain: ScanChain에서 지원하는 블록체인 (기본: ethereum)
40
+
41
+ Returns:
42
+ ScanResult: 스캔 결과
43
+ """
44
+ res = self._client._request(
45
+ "POST",
46
+ "/v1/scan/wallet",
47
+ body={
48
+ "address": address,
49
+ "chain": chain,
50
+ },
51
+ )
52
+
53
+ risk_factors = [
54
+ RiskFactor(
55
+ category=f["category"],
56
+ name=f["name"],
57
+ score=f["score"],
58
+ max_score=f["max_score"],
59
+ detail=f["detail"],
60
+ outbound_tx_count=f.get("outbound_tx_count"),
61
+ value_range=f.get("value_range"),
62
+ stablecoin_contracts=f.get("stablecoin_contracts"),
63
+ )
64
+ for f in res.get("risk_factors", [])
65
+ ]
66
+
67
+ chain_factors = [
68
+ ChainFactor(
69
+ factor=f["factor"],
70
+ impact=f["impact"],
71
+ description=f.get("description"),
72
+ )
73
+ for f in res.get("chain_factors", [])
74
+ ]
75
+
76
+ transactions = res.get("exposed_transactions")
77
+ stats = res.get("stats")
78
+ return ScanResult(
79
+ address=res["address"],
80
+ chain=res["chain"],
81
+ address_risk_score=res["address_risk_score"],
82
+ address_risk_grade=res["address_risk_grade"],
83
+ chain_readiness_grade=res["chain_readiness_grade"],
84
+ methodology_version=res.get("methodology_version", "v1.0"),
85
+ risk_factors=risk_factors,
86
+ chain_factors=chain_factors,
87
+ scan_timestamp=res.get("scan_timestamp", ""),
88
+ asset_value_usd=res.get("asset_value_usd"),
89
+ public_key_status=res.get("public_key_status"),
90
+ public_key_note=res.get("public_key_note"),
91
+ account_type=res.get("account_type"),
92
+ account_type_evidence=res.get("account_type_evidence"),
93
+ scan_id=res.get("scan_id"),
94
+ history_status=res.get("history_status"),
95
+ history_unavailable=res.get("history_unavailable"),
96
+ token_data_unavailable=res.get("token_data_unavailable"),
97
+ exposed_transactions=[
98
+ ExposedTransaction(
99
+ hash=tx["hash"],
100
+ value_eth=tx["value_eth"],
101
+ to=tx["to"],
102
+ timestamp=tx.get("timestamp"),
103
+ explorer_url=tx.get("explorer_url") or tx.get("etherscan_url") or None,
104
+ etherscan_url=tx.get("etherscan_url"),
105
+ )
106
+ for tx in transactions
107
+ ]
108
+ if transactions is not None
109
+ else None,
110
+ exposure_tx_count=res.get("exposure_tx_count"),
111
+ first_exposure_timestamp=res.get("first_exposure_timestamp"),
112
+ exposure_days=res.get("exposure_days"),
113
+ native_balance=res.get("native_balance"),
114
+ eth_balance=res.get("eth_balance"),
115
+ token_count=res.get("token_count"),
116
+ token_names=res.get("token_names"),
117
+ stats=ComparisonStats(
118
+ total_scanned=stats["total_scanned"],
119
+ percentile=stats["percentile"],
120
+ avg_score_similar=stats["avg_score_similar"],
121
+ )
122
+ if stats is not None
123
+ else None,
124
+ recommended_action=res.get("recommended_action"),
125
+ )
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,151 @@
1
+ # SECURITY: Only use secrets/os.urandom for randomness. Never import random.
2
+ """QuantumSafe SDK 데이터 타입 정의"""
3
+
4
+ from dataclasses import dataclass, field
5
+ from typing import Literal, Optional
6
+
7
+ # 지원 알고리즘 (NIST 표준명만)
8
+ Algorithm = Literal["ml-dsa-44", "ml-dsa-65", "ml-dsa-87", "slh-dsa-128s"]
9
+
10
+ # 키 등록 및 서명 체인
11
+ Chain = Literal["ethereum", "base", "arbitrum"]
12
+
13
+ # /v1/scan/wallet 지원 체인
14
+ ScanChain = Literal[
15
+ "ethereum", "base", "arbitrum", "polygon", "linea", "scroll", "gnosis", "celo",
16
+ "mantle", "blast", "optimism", "bsc", "avalanche", "sonic", "zksync",
17
+ "solana", "bitcoin", "cosmos", "tron",
18
+ ]
19
+ PublicKeyStatus = Literal["exposed", "safe", "unknown", "inapplicable"]
20
+ ScanAccountType = Literal["wallet", "unallocated", "cosmos_module", "solana_off_curve", "solana_program", "unclassified"]
21
+ HistoryStatus = Literal["complete", "limited", "unavailable"]
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class AlgorithmInfo:
26
+ """알고리즘 메타정보"""
27
+
28
+ nist_level: int
29
+ public_key_size: int
30
+ secret_key_size: int
31
+ signature_size: int
32
+ pqcrypto_module: str
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class KeyPair:
37
+ """로컬 생성된 PQC 키 쌍"""
38
+
39
+ public_key: str
40
+ private_key: str
41
+ algorithm: str
42
+ nist_level: int
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class RegisteredKey:
47
+ """서버 등록된 공개키"""
48
+
49
+ key_id: str
50
+ algorithm: str
51
+ nist_level: int
52
+ chain: str
53
+ custody: str
54
+
55
+
56
+ @dataclass(frozen=True)
57
+ class Attestation:
58
+ """하이브리드 서명 Attestation 결과"""
59
+
60
+ attestation_id: str
61
+ combined_hash: str
62
+ verified_at: str
63
+ chain: str
64
+
65
+
66
+ @dataclass(frozen=True)
67
+ class VerifyResult:
68
+ """서명 검증 결과"""
69
+
70
+ valid: bool
71
+ algorithm: str
72
+ nist_level: int
73
+ verified_at: str
74
+
75
+
76
+ @dataclass(frozen=True)
77
+ class RiskFactor:
78
+ """위험 요인"""
79
+
80
+ category: str
81
+ name: str
82
+ score: int
83
+ max_score: int
84
+ detail: str
85
+ outbound_tx_count: int | None = None
86
+ value_range: str | None = None
87
+ stablecoin_contracts: dict[str, str] | None = None
88
+
89
+
90
+ @dataclass(frozen=True)
91
+ class ChainFactor:
92
+ """체인 PQC 준비도 요인"""
93
+
94
+ factor: str
95
+ impact: str
96
+ description: str | None = None
97
+
98
+
99
+ @dataclass(frozen=True)
100
+ class ExposedTransaction:
101
+ """노출 근거가 된 거래. 금액은 원본 응답의 문자열 정밀도를 유지한다."""
102
+
103
+ hash: str
104
+ value_eth: str
105
+ to: str
106
+ timestamp: str | None = None
107
+ explorer_url: str | None = None
108
+ etherscan_url: str | None = None
109
+
110
+
111
+ @dataclass(frozen=True)
112
+ class ComparisonStats:
113
+ """스캔 점수 비교 통계"""
114
+
115
+ total_scanned: int
116
+ percentile: int
117
+ avg_score_similar: float
118
+
119
+
120
+ @dataclass(frozen=True)
121
+ class ScanResult:
122
+ """지갑 양자 위협 스캔 결과"""
123
+
124
+ address: str
125
+ chain: str
126
+ address_risk_score: int | None
127
+ address_risk_grade: str | None
128
+ chain_readiness_grade: str
129
+ methodology_version: str
130
+ risk_factors: list[RiskFactor] = field(default_factory=list)
131
+ chain_factors: list[ChainFactor] = field(default_factory=list)
132
+ scan_timestamp: str = ""
133
+ asset_value_usd: Optional[float] = None
134
+ public_key_status: PublicKeyStatus | None = None
135
+ public_key_note: str | None = None
136
+ history_status: HistoryStatus | None = None
137
+ history_unavailable: bool | None = None
138
+ token_data_unavailable: bool | None = None
139
+ exposed_transactions: list[ExposedTransaction] | None = None
140
+ exposure_tx_count: int | None = None
141
+ first_exposure_timestamp: str | None = None
142
+ exposure_days: int | None = None
143
+ native_balance: str | None = None
144
+ eth_balance: str | None = None
145
+ token_count: int | None = None
146
+ token_names: list[str] | None = None
147
+ stats: ComparisonStats | None = None
148
+ recommended_action: str | None = None
149
+ account_type: ScanAccountType | None = None
150
+ account_type_evidence: str | None = None
151
+ scan_id: str | None = None
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantumsafe
3
+ Version: 2.0.0
4
+ Summary: QuantumSafe — Post-quantum cryptography SDK for blockchain
5
+ License: MIT
6
+ Project-URL: Homepage, https://qsafe.dev
7
+ Project-URL: Documentation, https://docs.qsafe.dev
8
+ Project-URL: Repository, https://github.com/qshield-xyz/quantumsafe-python-sdk
9
+ Project-URL: Issues, https://github.com/qshield-xyz/quantumsafe-python-sdk/issues
10
+ Project-URL: Changelog, https://github.com/qshield-xyz/quantumsafe-python-sdk/blob/main/CHANGELOG.md
11
+ Keywords: quantum,pqc,blockchain,ml-dsa,post-quantum,cryptography,ethereum,solana,bitcoin
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Security :: Cryptography
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx>=0.27.0
24
+ Requires-Dist: pqcrypto<2.0.0,>=1.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8.0; extra == "dev"
27
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
28
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
29
+ Requires-Dist: respx>=0.21.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # quantumsafe
33
+
34
+ Post-quantum cryptography SDK for blockchain. Scan wallets for quantum risk, generate PQC keys, and verify PQC signatures.
35
+
36
+ Docs: [docs.qsafe.dev](https://docs.qsafe.dev) · Issues: [GitHub](https://github.com/qshield-xyz/quantumsafe-python-sdk/issues) · [Changelog](CHANGELOG.md)
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install quantumsafe
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ Set `QSAFE_API_KEY` to your server-side secret API key. Generate a local key pair, register the public key and verify a PQC signature over a message.
47
+
48
+ ```python
49
+ import os
50
+ from pqcrypto.sign import ml_dsa_65
51
+ from quantumsafe import QuantumSafe
52
+
53
+ with QuantumSafe(api_key=os.environ["QSAFE_API_KEY"]) as qs:
54
+ keypair = qs.keys.generate(algorithm="ml-dsa-65")
55
+ qs.keys.register(public_key=keypair.public_key, chain="ethereum")
56
+ message = bytes.fromhex("deadbeef")
57
+ signature = ml_dsa_65.sign(bytes.fromhex(keypair.private_key), message)
58
+ result = qs.verify(public_key=keypair.public_key, message=message.hex(), signature=signature.hex())
59
+ print(result.valid)
60
+ ```
61
+
62
+ In the updated SDK source, set `QSAFE_ADDRESS` to an address on the chain you want to scan.
63
+
64
+ ```python
65
+ with QuantumSafe(api_key=os.environ["QSAFE_API_KEY"]) as qs:
66
+ scan = qs.scan.wallet(chain="bitcoin", address=os.environ["QSAFE_ADDRESS"])
67
+ print(scan.methodology_version, scan.public_key_status, scan.history_status)
68
+ if scan.address_risk_score is not None:
69
+ print(scan.address_risk_score, scan.address_risk_grade)
70
+ if scan.token_data_unavailable:
71
+ print("Token data unavailable")
72
+ for tx in scan.exposed_transactions or []:
73
+ print(tx.hash, tx.explorer_url)
74
+ ```
75
+
76
+ ## Supported Chains
77
+
78
+ Wallet scans support `ethereum`, `base`, `arbitrum`, `polygon`, `linea`, `scroll`, `gnosis`, `celo`, `mantle`, `blast`, `optimism`, `bsc`, `avalanche`, `sonic`, `zksync`, `solana`, `bitcoin`, `cosmos`, and `tron`. The exported `ScanChain` type lists these values. Key registration and hybrid signing support `ethereum`, `base`, and `arbitrum`.
79
+
80
+ `history_status` reports `complete`, `limited`, or `unavailable`. `public_key_status` reports `exposed`, `safe`, or `unknown`. A scan can include transaction evidence even with limited history. An unavailable score and grade are `None`; a measured zero is returned as `0`. Older responses that omit the coverage fields return `None` for those fields.
81
+
82
+ ## Documentation
83
+
84
+ Full API docs: [https://docs.qsafe.dev](https://docs.qsafe.dev)
85
+
86
+ ## License
87
+
88
+ MIT — see [LICENSE](./LICENSE)
@@ -1,9 +1,11 @@
1
+ CHANGELOG.md
1
2
  LICENSE
2
3
  MANIFEST.in
3
4
  README.md
4
5
  pyproject.toml
5
6
  quantumsafe/__init__.py
6
7
  quantumsafe/client.py
8
+ quantumsafe/py.typed
7
9
  quantumsafe/types.py
8
10
  quantumsafe.egg-info/PKG-INFO
9
11
  quantumsafe.egg-info/SOURCES.txt
@@ -1,5 +1,5 @@
1
1
  httpx>=0.27.0
2
- pqcrypto>=0.1.0
2
+ pqcrypto<2.0.0,>=1.0.0
3
3
 
4
4
  [dev]
5
5
  pytest>=8.0
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,85 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: quantumsafe
3
- Version: 1.0.0
4
- Summary: QuantumSafe — Post-quantum cryptography SDK for blockchain
5
- License: MIT
6
- Project-URL: Homepage, https://qsafe.dev
7
- Project-URL: Documentation, https://docs.qsafe.dev
8
- Project-URL: Repository, https://github.com/quantumsafe/sdk
9
- Keywords: quantum,pqc,blockchain,ml-dsa,post-quantum,cryptography,ethereum,solana,bitcoin
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Topic :: Security :: Cryptography
18
- Requires-Python: >=3.10
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: httpx>=0.27.0
22
- Requires-Dist: pqcrypto>=0.1.0
23
- Provides-Extra: dev
24
- Requires-Dist: pytest>=8.0; extra == "dev"
25
- Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
26
- Requires-Dist: ruff>=0.4.0; extra == "dev"
27
- Requires-Dist: respx>=0.21.0; extra == "dev"
28
- Dynamic: license-file
29
-
30
- # quantumsafe
31
-
32
- Post-quantum cryptography SDK for blockchain. Scan wallets for quantum risk, generate PQC keys, and verify hybrid signatures.
33
-
34
- ## Install
35
-
36
- ```bash
37
- pip install quantumsafe
38
- ```
39
-
40
- ## Quick Start
41
-
42
- ```python
43
- import asyncio
44
- from quantumsafe import QuantumSafe
45
-
46
- async def main():
47
- qs = QuantumSafe(api_key="your-api-key")
48
-
49
- # 1. Scan a wallet for quantum risk
50
- scan = await qs.scan_wallet(chain="ethereum", address="0xYourAddress")
51
- print(f"Risk score: {scan.risk_score}")
52
-
53
- # 2. Generate a post-quantum key pair
54
- keys = await qs.generate_key(algorithm="ml-dsa-65", chain="ethereum")
55
- print(f"Public key: {keys.public_key}")
56
-
57
- # 3. Register key on-chain & verify
58
- registered = await qs.register_key(chain="ethereum", public_key=keys.public_key)
59
-
60
- result = await qs.verify(
61
- chain="ethereum",
62
- address="0xYourAddress",
63
- attestation_id=registered.attestation_id,
64
- )
65
- print(f"Verified: {result.verified}")
66
-
67
- asyncio.run(main())
68
- ```
69
-
70
- ## Supported Chains
71
-
72
- - Ethereum
73
- - Solana
74
- - Bitcoin
75
- - Polygon
76
- - Avalanche
77
- - Cosmos
78
-
79
- ## Documentation
80
-
81
- Full API docs: [https://docs.qsafe.dev](https://docs.qsafe.dev)
82
-
83
- ## License
84
-
85
- MIT — see [LICENSE](./LICENSE)
@@ -1,56 +0,0 @@
1
- # quantumsafe
2
-
3
- Post-quantum cryptography SDK for blockchain. Scan wallets for quantum risk, generate PQC keys, and verify hybrid signatures.
4
-
5
- ## Install
6
-
7
- ```bash
8
- pip install quantumsafe
9
- ```
10
-
11
- ## Quick Start
12
-
13
- ```python
14
- import asyncio
15
- from quantumsafe import QuantumSafe
16
-
17
- async def main():
18
- qs = QuantumSafe(api_key="your-api-key")
19
-
20
- # 1. Scan a wallet for quantum risk
21
- scan = await qs.scan_wallet(chain="ethereum", address="0xYourAddress")
22
- print(f"Risk score: {scan.risk_score}")
23
-
24
- # 2. Generate a post-quantum key pair
25
- keys = await qs.generate_key(algorithm="ml-dsa-65", chain="ethereum")
26
- print(f"Public key: {keys.public_key}")
27
-
28
- # 3. Register key on-chain & verify
29
- registered = await qs.register_key(chain="ethereum", public_key=keys.public_key)
30
-
31
- result = await qs.verify(
32
- chain="ethereum",
33
- address="0xYourAddress",
34
- attestation_id=registered.attestation_id,
35
- )
36
- print(f"Verified: {result.verified}")
37
-
38
- asyncio.run(main())
39
- ```
40
-
41
- ## Supported Chains
42
-
43
- - Ethereum
44
- - Solana
45
- - Bitcoin
46
- - Polygon
47
- - Avalanche
48
- - Cosmos
49
-
50
- ## Documentation
51
-
52
- Full API docs: [https://docs.qsafe.dev](https://docs.qsafe.dev)
53
-
54
- ## License
55
-
56
- MIT — see [LICENSE](./LICENSE)
@@ -1,76 +0,0 @@
1
- # SECURITY: Only use secrets/os.urandom for randomness. Never import random.
2
- """지갑 양자 위협 스캔 모듈"""
3
-
4
- from __future__ import annotations
5
-
6
- import logging
7
- from typing import TYPE_CHECKING
8
-
9
- from quantumsafe.types import ChainFactor, RiskFactor, ScanResult
10
-
11
- if TYPE_CHECKING:
12
- from quantumsafe.client import QuantumSafe
13
-
14
- logger = logging.getLogger("quantumsafe.scan")
15
-
16
-
17
- class ScanModule:
18
- """지갑 양자 위협 스캔 모듈"""
19
-
20
- def __init__(self, client: QuantumSafe) -> None:
21
- self._client = client
22
-
23
- def wallet(
24
- self,
25
- address: str,
26
- chain: str = "ethereum",
27
- ) -> ScanResult:
28
- """지갑 양자 위협 스캔
29
-
30
- Args:
31
- address: 이더리움 주소 (0x...)
32
- chain: 블록체인 (기본: ethereum)
33
-
34
- Returns:
35
- ScanResult: 스캔 결과
36
- """
37
- res = self._client._request(
38
- "POST",
39
- "/v1/scan/wallet",
40
- body={
41
- "address": address,
42
- "chain": chain,
43
- },
44
- )
45
-
46
- risk_factors = [
47
- RiskFactor(
48
- category=f["category"],
49
- name=f["name"],
50
- score=f["score"],
51
- max_score=f["max_score"],
52
- detail=f["detail"],
53
- )
54
- for f in res.get("risk_factors", [])
55
- ]
56
-
57
- chain_factors = [
58
- ChainFactor(
59
- factor=f["factor"],
60
- impact=f["impact"],
61
- )
62
- for f in res.get("chain_factors", [])
63
- ]
64
-
65
- return ScanResult(
66
- address=res["address"],
67
- chain=res["chain"],
68
- address_risk_score=res["address_risk_score"],
69
- address_risk_grade=res["address_risk_grade"],
70
- chain_readiness_grade=res["chain_readiness_grade"],
71
- methodology_version=res.get("methodology_version", "v1.0"),
72
- risk_factors=risk_factors,
73
- chain_factors=chain_factors,
74
- scan_timestamp=res.get("scan_timestamp", ""),
75
- asset_value_usd=res.get("asset_value_usd"),
76
- )
@@ -1,98 +0,0 @@
1
- # SECURITY: Only use secrets/os.urandom for randomness. Never import random.
2
- """QuantumSafe SDK 데이터 타입 정의"""
3
-
4
- from dataclasses import dataclass, field
5
- from typing import Literal, Optional
6
-
7
- # 지원 알고리즘 (NIST 표준명만)
8
- Algorithm = Literal["ml-dsa-44", "ml-dsa-65", "ml-dsa-87", "slh-dsa-128s"]
9
-
10
- # 지원 체인
11
- Chain = Literal["ethereum", "base", "arbitrum"]
12
-
13
-
14
- @dataclass(frozen=True)
15
- class AlgorithmInfo:
16
- """알고리즘 메타정보"""
17
-
18
- nist_level: int
19
- public_key_size: int
20
- secret_key_size: int
21
- signature_size: int
22
- pqcrypto_module: str
23
-
24
-
25
- @dataclass(frozen=True)
26
- class KeyPair:
27
- """로컬 생성된 PQC 키 쌍"""
28
-
29
- public_key: str
30
- private_key: str
31
- algorithm: str
32
- nist_level: int
33
-
34
-
35
- @dataclass(frozen=True)
36
- class RegisteredKey:
37
- """서버 등록된 공개키"""
38
-
39
- key_id: str
40
- algorithm: str
41
- nist_level: int
42
- chain: str
43
- custody: str
44
-
45
-
46
- @dataclass(frozen=True)
47
- class Attestation:
48
- """하이브리드 서명 Attestation 결과"""
49
-
50
- attestation_id: str
51
- combined_hash: str
52
- verified_at: str
53
- chain: str
54
-
55
-
56
- @dataclass(frozen=True)
57
- class VerifyResult:
58
- """서명 검증 결과"""
59
-
60
- valid: bool
61
- algorithm: str
62
- nist_level: int
63
- verified_at: str
64
-
65
-
66
- @dataclass(frozen=True)
67
- class RiskFactor:
68
- """위험 요인"""
69
-
70
- category: str
71
- name: str
72
- score: int
73
- max_score: int
74
- detail: str
75
-
76
-
77
- @dataclass(frozen=True)
78
- class ChainFactor:
79
- """체인 PQC 준비도 요인"""
80
-
81
- factor: str
82
- impact: str
83
-
84
-
85
- @dataclass(frozen=True)
86
- class ScanResult:
87
- """지갑 양자 위협 스캔 결과"""
88
-
89
- address: str
90
- chain: str
91
- address_risk_score: int
92
- address_risk_grade: str
93
- chain_readiness_grade: str
94
- methodology_version: str
95
- risk_factors: list[RiskFactor] = field(default_factory=list)
96
- chain_factors: list[ChainFactor] = field(default_factory=list)
97
- scan_timestamp: str = ""
98
- asset_value_usd: Optional[float] = None
@@ -1,85 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: quantumsafe
3
- Version: 1.0.0
4
- Summary: QuantumSafe — Post-quantum cryptography SDK for blockchain
5
- License: MIT
6
- Project-URL: Homepage, https://qsafe.dev
7
- Project-URL: Documentation, https://docs.qsafe.dev
8
- Project-URL: Repository, https://github.com/quantumsafe/sdk
9
- Keywords: quantum,pqc,blockchain,ml-dsa,post-quantum,cryptography,ethereum,solana,bitcoin
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Topic :: Security :: Cryptography
18
- Requires-Python: >=3.10
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: httpx>=0.27.0
22
- Requires-Dist: pqcrypto>=0.1.0
23
- Provides-Extra: dev
24
- Requires-Dist: pytest>=8.0; extra == "dev"
25
- Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
26
- Requires-Dist: ruff>=0.4.0; extra == "dev"
27
- Requires-Dist: respx>=0.21.0; extra == "dev"
28
- Dynamic: license-file
29
-
30
- # quantumsafe
31
-
32
- Post-quantum cryptography SDK for blockchain. Scan wallets for quantum risk, generate PQC keys, and verify hybrid signatures.
33
-
34
- ## Install
35
-
36
- ```bash
37
- pip install quantumsafe
38
- ```
39
-
40
- ## Quick Start
41
-
42
- ```python
43
- import asyncio
44
- from quantumsafe import QuantumSafe
45
-
46
- async def main():
47
- qs = QuantumSafe(api_key="your-api-key")
48
-
49
- # 1. Scan a wallet for quantum risk
50
- scan = await qs.scan_wallet(chain="ethereum", address="0xYourAddress")
51
- print(f"Risk score: {scan.risk_score}")
52
-
53
- # 2. Generate a post-quantum key pair
54
- keys = await qs.generate_key(algorithm="ml-dsa-65", chain="ethereum")
55
- print(f"Public key: {keys.public_key}")
56
-
57
- # 3. Register key on-chain & verify
58
- registered = await qs.register_key(chain="ethereum", public_key=keys.public_key)
59
-
60
- result = await qs.verify(
61
- chain="ethereum",
62
- address="0xYourAddress",
63
- attestation_id=registered.attestation_id,
64
- )
65
- print(f"Verified: {result.verified}")
66
-
67
- asyncio.run(main())
68
- ```
69
-
70
- ## Supported Chains
71
-
72
- - Ethereum
73
- - Solana
74
- - Bitcoin
75
- - Polygon
76
- - Avalanche
77
- - Cosmos
78
-
79
- ## Documentation
80
-
81
- Full API docs: [https://docs.qsafe.dev](https://docs.qsafe.dev)
82
-
83
- ## License
84
-
85
- MIT — see [LICENSE](./LICENSE)