Skip to main content

ZeroKno is a lightweight zero-knowledge password storage library for Python 3.7+

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zerokno-2.0.0.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file zerokno-2.0.0.tar.gz.

File metadata

  • Download URL: zerokno-2.0.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for zerokno-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c19ebfe55658dadd61d8f19fc4442a4e8fd99c484366cd7c85fb6b5eb22a1a43
MD5 7651199f42e0e4108f52aafedbdd1be5
BLAKE2b-256 29801c39e9300bcece8604af84ab44e21abfc72c348ac53785babcfd6acd16de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page