shifra-api
Server-driven licensing for Python products. You configure one thing: your license key.
from shifra_api import run
run("YOUR-LICENSE-KEY")
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 run
run("YOUR-LICENSE-KEY")
That single call verifies the license and device, resolves the linked Python product, downloads and verifies its published release, prints the Console Identity configured by the workspace owner, runs the release under heartbeat supervision, applies server-authorized updates, and closes the session on exit.
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 a supervised subprocess without a temporary plaintext source file, so heartbeat revocation can stop it. Anyone with control of the machine can still inspect process memory — this package protects authorization and integrity, not absolute source secrecy.
Metadata
Release files for shifra-api 2.2.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.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / shifra_api-2.2.0-py3-none-any.whl
| Download URL | shifra_api-2.2.0-py3-none-any.whl |
|---|---|
| Size | 29.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d13d4c5f591cc7853186b22c031b8c1b10d256189e990a4e97d41cb56b29dfa9
|
|
BLAKE2b-256 checksum How to use checksums |
231016817baec9c13884d6244c2217245dd1600e4d4086e9ec8271d6a3e44066
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for shifra-api 2.2.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.