Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kgt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kgt

Python tools for Keygen.sh licensing

  • 0.4.7
  • PyPI
  • Socket score

Maintainers
1

kgt

PyPi Version PyPI pyversions

Code style: black

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 get_online_license_info, ValidationError

info = get_online_license_info(
    account_id="demo", key="DEMO-DAD877-FCBF82-B83D5A-03E644-V3"
)

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 get_cached_license_info, ValidationError

infi = get_cached_license_info(
    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),
)

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 get_offline_license_info

# 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"

info = get_offline_license_info(license_scheme, license_key, keygen_verify_key)
print(info)

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc