Registry / security / jws
library0.1.3pypypi✓ verified 84d ago

A lightweight implementation of JSON Web Signatures (JWS) for signing and verifying payloads with HMAC, RSA, and ECDSA algorithms. Version 0.1.3 is the current release with infrequent updates; the library is in maintenance mode.

pip install jws
INSTALL
IMPORT
SIG · JWS
J
jws
securitypythonv0.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sign
from jws import sign
import jws; jws.sign(...)
Direct import is correct; avoiding module-level reference is clearer.
verify
from jws import verify

Basic sign and verify with HMAC SHA-256.

from jws import sign, verify import os secret = os.environ.get('JWS_SECRET', 'my-secret') payload = {'sub': '1234567890', 'name': 'John Doe'} # Sign with HS256 signed = sign(payload, secret, alg='HS256') print('Signed:', signed) # Verify verified = verify(signed, secret) print('Verified payload:', verified)
Debug
Known issues
deprecatedLibrary is no longer actively maintained; consider using 'PyJWT' or 'python-jose' for production.
fix
Switch to 'PyJWT' or 'python-jose' for long-term support.
affects: >=0.1.0
gotchaAlgorithm 'none' is accepted by default, allowing unsigned tokens if not explicitly blocked.
fix
Always validate algorithm against a whitelist; avoid passing user-supplied algorithm.
affects: 0.1.3
gotchaPayload must be a dictionary; other JSON-serializable types may cause silent errors.
fix
Ensure payload is a dict. Convert lists or strings to dict if needed.
affects: 0.1.3
Errors
Common errors & fixes
AttributeError: module 'jws' has no attribute 'sign'
Attempting to use 'jws.sign' without direct import of sign function.
fix
Use 'from jws import sign' or 'from jws import *' (not recommended).
jws.exceptions.InvalidSignature: Invalid signature
Wrong secret or algorithm mismatch between sign and verify.
fix
Ensure same secret and algorithm are used for both sign and verify.
TypeError: Object of type 'list' is not JSON serializable
Payload is a list or other non-dict type.
fix
Wrap payload in a dict, e.g., {'data': payload_list}.
Upgrade
Version history
0.1.3latest on PyPI · released Mar 10, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Resources
jws — pip install jws · libregistry