Python tools for Keygen.sh licensing
Project description
kgt
Some handy tools for the Keygen licensing service. (This is a user contribution, not an official Keygen LLC product. For Keygen software, see here.)
Install with
pip install kgt
and use as
import sys
from kgt import validate_license_key_online, ValidationError
try:
out = validate_license_key_online(
account_id="demo", key="DEMO-DAD877-FCBF82-B83D5A-03E644-V3"
)
except ValidationError as e:
print(f"Error: Invalid license ({e.code}). Exiting.")
sys.exit(1)
The out
object contains useful information such as
out.code
out.timestamp
out.license_creation_time
out.license_expiry_time
The validation result can also be safely cached with
import sys
from datetime import datetime, timedelta
from kgt import validate_license_key_cached, ValidationError
try:
out = validate_license_key_cached(
account_id="your accound id",
key="the license key",
keygen_verify_key="your Ed25519 128-bit Verify Key",
cache_path="/tmp/license-cache.json",
refresh_cache_period=timedelta(days=3),
)
except ValidationError as e:
print(f"Error: Invalid license ({e.code}). Exiting.")
sys.exit(1)
now = datetime.utcnow()
cache_age = now - out.timestamp
if cache_age > timedelta(days=3) and cache_age < timedelta(days=7):
print("Warning: Could not validate license. Make sure to get online soon.")
elif cache_age > timedelta(days=7):
print("Error: Could not validate license. Internet connection needed. Exiting.")
sys.exit(1)
For offline validation, use
from kgt import validate_offline_key
# or "RSA_2048_PKCS1_SIGN_V2", "RSA_2048_PKCS1_PSS_SIGN_V2":
license_scheme = "ED25519_SIGN"
keygen_verify_key = "your public verify key"
license_key = "your offline license key"
try:
data = validate_offline_key(license_scheme, license_key, keygen_verify_key)
except ValidationError as e:
print(f"Error: Invalid license ({e.code}). Exiting.")
sys.exit(1)
print(data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
kgt-0.3.3-cp310-cp310-win_amd64.whl
(196.2 kB
view hashes)
kgt-0.3.3-cp39-cp39-win_amd64.whl
(195.3 kB
view hashes)
kgt-0.3.3-cp38-cp38-win_amd64.whl
(194.7 kB
view hashes)
kgt-0.3.3-cp37-cp37m-win_amd64.whl
(188.5 kB
view hashes)
Close
Hashes for kgt-0.3.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b909b8cbdbbcad646b36678a437d8ee5b5e9db1b9d7de3884e2252ad74a727c |
|
MD5 | c9a1e1d81e6c646b192234cffdcba58c |
|
BLAKE2b-256 | 70e0ed7832e24ba4122fe4daa6c43ad4faeaef0af37052b1830426d84eb6cede |
Close
Hashes for kgt-0.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91290927a9194d2bc62b7954580f5b8395cd5f0b444d29a0403d797f8739324c |
|
MD5 | ae1903f51b20d3a43da56c6a8bbe33bb |
|
BLAKE2b-256 | 5ce1d499abe114127ac2b05797c054d7643b9ee9234afbc6c82966aafc1ebb40 |
Close
Hashes for kgt-0.3.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48f6540cceddcb150384aab5e13237a33c4b237f94509bf01aac0c3aa8ea7f97 |
|
MD5 | cd10ef2075f481af66f1fd854b1e94a7 |
|
BLAKE2b-256 | 4d0fe8fa22f20708953555e3624f594dfb2154eed71a80037752c9a64174e9d2 |
Close
Hashes for kgt-0.3.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0686da9faa9c49483b0f646d99f6cc7f997f8b72b8abdd14286aab1901af5665 |
|
MD5 | efaec8cbbf20210b0067c4daf90206a4 |
|
BLAKE2b-256 | 0d48646d189cd23c27ef877d2b6af89da6e473880342cc25339c83a7d3a59a9b |
Close
Hashes for kgt-0.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36288ba85c8ccca58bf484c9a3f9ea54aab1a76449b5a5be30d74854519f65de |
|
MD5 | 1e2de9a731397b1259da85784fd8b499 |
|
BLAKE2b-256 | 33715ec39db1902a67f0051044f9d46ca939f5880a5ac525d582b794c37034a7 |
Close
Hashes for kgt-0.3.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed0ed0d7833cdcddb34f3fd6965cfeeb72bfd6f113dbac12388ccad8d9f8378b |
|
MD5 | c85a4907d576e8458b2c91c11b1af511 |
|
BLAKE2b-256 | b7877229682af5731906592952dc5968e577459b7032e3464471d720bba11187 |
Close
Hashes for kgt-0.3.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bd02b765da53268595a48d2e8327caaef1f0bda1911d7b423a8bccaed223988 |
|
MD5 | dcc8f052c311d41d1be177e2df356ec1 |
|
BLAKE2b-256 | dd5bcc2f8a9622f9bdcf8f298adab534eefad47a836f3a1fda7761fc0b4cfc2d |
Close
Hashes for kgt-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aebfe637b633f75459eed8de64218c84293ad382bd63736aa6e1a2ff2a0a9672 |
|
MD5 | 44abff3e511a8fc08f62d799c9f5103a |
|
BLAKE2b-256 | 72b4a9336be78b5c1e97f74e1c993e7b3164bbc9f0c30f808f32ea2a6daa97df |
Close
Hashes for kgt-0.3.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8633acf213b075d2b3be8d4e0846dc499007d517977946481f1368f3d5bf7242 |
|
MD5 | 81ee04d9d68a9db47a0c064c6146094d |
|
BLAKE2b-256 | 78e17cee3e725858c2257d30fa969af98fb50afb26b11aa574b130d7f4aedc31 |
Close
Hashes for kgt-0.3.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4fd92d743dd7811dd01140702b913ba9607727e25439366ff83d557f33da427 |
|
MD5 | eeb5e07ec7c37ec4c4a236b18e8009f0 |
|
BLAKE2b-256 | a3f1785e2af679ac01087cd32193b632de18d61abaf4cf37808231fa90530fa4 |
Close
Hashes for kgt-0.3.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4bc72e11cca15c78b446115c5490e7fa46a6269020ce755097ae75d9f2b09fa |
|
MD5 | aaa0e7bca8c0483ad484e31c90a3b59b |
|
BLAKE2b-256 | d4d9d6875bb13271233bed6fe5b1aaf24d67d993b4d9060c68c7d016459a0bfc |
Close
Hashes for kgt-0.3.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc10a7b733eba81275a4923f27919c4f99dbad8ba198ea748305ae938db5fee8 |
|
MD5 | ff9949a0136e7b9691ac8a089a1c05cc |
|
BLAKE2b-256 | b8c2516a1fb2f33450b74310692cd49d4534cfb0294812eeb471710a71e764b8 |