Skip to main content

A Python port of the Mako (PHP framework) security library.

Project description

Okam Security

Build Status

A Python port of the Mako (PHP framework) security library.

Usage

Key

The Key class allows you to generate, encode and decode keys that can be used for cryptographic purposes.

from okam.security import Key

# Returns 32 random bytes, you can also pass the number of bytes you want to return

key = Key.generate()

# Returns a hex representation of the random bytes prefixed by 'hex:'

encoded = Key.encode(key)

# Returns the random bytes that were encoded

key = Key.decode(key)

# Returns a hex representation of 32 random bytes prefixed by 'hex:',
# you can also pass the number of bytes you want to return

encoded = Key.generate_encoded()

Signer

The Signer class allows you to verify both the data integrity and the authenticity of strings. A HMAC (hash-based message authentication code) will be prepended to your string upon signing and stripped when validated.

from okam.security import Key
from okam.security import Signer

signer = Signer(Key.generate())

# Signs the string

signed = signer.sign('hello, world!')

# Returns the original string if the string can be authenticated and False if not

string = signer.validate(signed)

Project details


Download files

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

Files for okam-security, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size okam_security-0.1.1-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size okam-security-0.1.1.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page