https://github.com/zweifisch/signer
a python module for message signing
https://github.com/zweifisch/signer
Last synced: over 1 year ago
JSON representation
a python module for message signing
- Host: GitHub
- URL: https://github.com/zweifisch/signer
- Owner: zweifisch
- Created: 2014-04-09T04:36:45.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-09T07:37:41.000Z (over 12 years ago)
- Last Synced: 2025-03-08T06:47:49.969Z (over 1 year ago)
- Language: Python
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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)
```