Metadata-Version: 2.4
Name: tiksignV1
Version: 0.1.0
Summary: Python port of the TikTok signature algorithms from the referenced Java project
Author: S1 / JokerPython3 Java-port contributors
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=41

# TikTokSignatrueForJava — Python port

This directory is a Python conversion of the Java files in `src/main/java/tiktoksignature` from the referenced repository. It preserves the six-result signing API and the deterministic override fields used by the original test vectors.

## Install

```bash
python -m pip install -r requirements.txt
```

## Usage

```python
from tiktoksignature import Param, SignRequest, SignOptions, sign

request = SignRequest(
    params=[Param("device_id", "7442000000000000001"), Param("version_name", "41.9.3")],
    data=[Param("type", "3736")],
)
options = SignOptions(version=8404)
signatures = sign(request, options)
print(signatures.as_headers)
```

`SignRequest` accepts ordered `Param` sequences for `params`, `data`, `payload`, and `cookie`. `rawBody` can be used to supply a body string verbatim. For reproducible tests, set `timestamp`, `gorgonByte3`, `gorgonByte7`, `argusRand`, and `ladonRandom` in `SignOptions`.

## Validation

The included `test_vectors.py` compares all six outputs against the nine golden vectors from the Java repository:

```bash
PYTHONPATH=. python -m tiktoksignature.test_vectors /path/to/TikTokSignatrueForJava/testdata
```

All nine vectors pass in this conversion.

## Modules

The Java files were converted to corresponding Python modules: `Argus.py`, `CryptoHelpers.py`, `Gorgon.py`, `Ladon.py`, `MiniJson.py`, `Param.py`, `ProtoBuf.py`, `SM3.py`, `SignOptions.py`, `SignRequest.py`, `Signatures.py`, `Signer.py`, `Simon.py`, and `UrlEncode.py`.

The implementation is intended for authorized testing and interoperability only. Keep generated signatures, cookies, and device identifiers private.
