Skip to main content

a python module for message signing

Project description

# signer

```python
from signer import Signer
from datetime import datetime, timedelta

signer = Signer(b'secret key')

tomorrow = datetime.utcnow() + timedelta(days=1)
signed_message = signer.sign(b'message', expires=tomorrow)

signer.verify(signed_message)
```

* signed message is not encrypted
* if the signature failed the verification, verify() returns `None`
* if expired, verfiy() returns `None`

signing as json and tuple

```python
signer.sign_json(dict(key="value"))

signer.sign_record(['some', b'msg'], expires=tomorrow)

signer.sign(obj, encoder=encode_fn)
signer.verify(signed_bytes, decoder=decode_fn)
```

specify hash method

```python
Signer(method='sha1', digest_size=20)
```

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 signer, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size signer-0.0.1.tar.gz (2.3 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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page