Skip to main content

ZeroKno

ZeroKno is a simple, easy to use and lightweight zero-knowledge password storage method for Python. The keys are stored in plain text, while the passwords are stored as base58-encoded SHA-256 hashes.

This makes it impossible for the application to know the password, while still being able to verify it. If you want to use this in a production environment, please make sure to use a secure storage method for the keys (e.g. a secure database).

Note that the passwords or values are not encrypted, but hashed. This means that the password cannot be retrieved from the hash, but the hash can be used to verify the password. Basically, you can't recover the password if you lose it.

Installation

pip install zerokno

Usage

from zerokno import ZeroKno

# Create a new ZeroKno instance -- app_secret is a secret key for the application and storage is a directory to store the password hashes
zk = ZeroKno(app_secret, storage) 

# Add a new password -- please note that the password is stored as a hash, while the user id is stored as plain text
zk.store("password", "userid")

# Check password match
zk.validate("password", "userid")
# True
zk.validate("passwor1d", "userid")
# False
zk.validate("password", "userid1")
# Error: Userid not found

Errors

  • Key not found - This error is raised when the user id is not found in the storage
  • Any other error is raised when the storage file is not found or the storage file is corrupted or in any other way not accessible

Release files for zerokno 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zerokno 2.0.0
File Size Uploaded
zerokno-2.0.0.tar.gz 2.3 kB Details

Release files / zerokno-2.0.0.tar.gz

Download URL zerokno-2.0.0.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c19ebfe55658dadd61d8f19fc4442a4e8fd99c484366cd7c85fb6b5eb22a1a43
BLAKE2b-256 checksum
How to use checksums
29801c39e9300bcece8604af84ab44e21abfc72c348ac53785babcfd6acd16de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.0.0 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page