shifra-api
Server-driven licensing for Python products. You configure one thing: your license key.
from shifra_api import Shafra
Shafra("YOUR-LICENSE-KEY").run()
Everything else — which script runs, its version, heartbeat settings, device and network policy, branding — is decided by the Shifra server from your key.
Install
pip install shifra-api
Requires Python 3.9+ and the cryptography package (installed automatically).
Distribution builds are produced by Shifra's build process, which embeds the API origin and the pinned signing key. A plain source checkout has neither and will refuse to start — that is intentional.
Usage
Run the protected script
from shifra_api import Shafra
Shafra("YOUR-LICENSE-KEY").run()
Check a license without running anything
from shifra_api import Shafra, ShafraError
try:
license = Shafra("YOUR-LICENSE-KEY").verify()
except ShafraError as error:
print(error.code, error.message)
else:
print(license.product_name, license.product_version)
print("expires:", license.expires_at)
Hold a verified session while your own code runs
from shifra_api import Shafra
with Shafra("YOUR-LICENSE-KEY") as session:
app.run() # heartbeat is active for the whole block
The session ends when the block exits. If the license is revoked mid-run, the
heartbeat stops and a SessionRevoked error is raised when the block closes.
Errors
Every failure has a stable code. Import the specific class or catch
ShafraError:
| Code | Meaning |
|---|---|
LICENSE_INVALID |
Key not found |
LICENSE_EXPIRED |
License expired |
LICENSE_REVOKED |
License banned or revoked |
LICENSE_NOT_LINKED |
Key not assigned to a product yet |
HWID_MISMATCH |
Bound to a different device |
DEVICE_LIMIT_REACHED |
Too many devices for this license |
IP_NOT_ALLOWED |
Network not permitted |
LOADER_UPDATE_REQUIRED |
Update the client |
MAINTENANCE |
Service in maintenance |
NETWORK_TIMEOUT / NETWORK_ERROR |
Could not reach the server |
INVALID_SERVER_SIGNATURE |
Response failed verification |
PAYLOAD_INTEGRITY_FAILED |
Downloaded script failed its digest check |
SESSION_REVOKED / SESSION_EXPIRED |
Runtime session ended |
Connection problems are never reported as signature failures.
About the hardware identity
The client derives a fingerprint from stable machine identifiers and sends only a SHA-256 digest. Raw identifiers never leave your machine. This is a signal for the server to bind licenses to devices, not hardware attestation.
Security notes
- Responses are verified with an Ed25519 key embedded in the build. A signature received over the network is never used as a trust anchor.
- Downloads are checked against a signed digest before anything runs.
- The protected script runs in-process. Anyone with control of the machine can read it from memory — this package protects authorization and integrity, not source secrecy.
Metadata
Release files for shifra-api 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shifra_api-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / shifra_api-2.1.0-py3-none-any.whl
| Download URL | shifra_api-2.1.0-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
406e9d8b548cbd5f19efb85cc51dfe68f11dbc0c65701d492f1b29d65d364817
|
|
BLAKE2b-256 checksum How to use checksums |
0652ea001a8c568a94cf57af22ee6f58f9863af89a9b736247c0bc85684ae150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0b3
|
Security for shifra-api 2.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.