Install & Compatibility
Where this runs
tested against v1.1.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.140s · 23.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.1s · import 0.134s · 24MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
sign_json
✓ from signedjson.sign import sign_json
✗ from signedjson import sign_json
sign_json is not exposed at package level; import from submodule
verify_signed_json
✓ from signedjson.sign import verify_signed_json
✗ from signedjson import verify_signed_json
Same as above: must import from submodule
encode_canonical_json
✓ from signedjson.canonical import encode_canonical_json
✗ from signedjson import encode_canonical_json
Canonical encoding is in its own submodule
KEY_LEN
✓ from signedjson.key import KEY_LEN
✗ from signedjson import KEY_LEN
Key constants are in the key submodule
Basic signing and verification with Ed25519.
import os
from signedjson.key import generate_signing_key, write_signing_keys
from signedjson.sign import sign_json, verify_signed_json
# Generate a key pair (Ed25519)
key = generate_signing_key('mykey')
# Sign a JSON object
json_obj = {"hello": "world"}
signed = sign_json(json_obj, key)
print("Signed:", signed)
# Verify with the same key
verified = verify_signed_json(signed, key.alg, key.version)
assert verified == json_obj
# Write keys to a file (optional)
write_signing_keys([key], 'keys.txt')
# Read back: read_signing_keys opens the file
Errors
Common errors & fixes
AttributeError: module 'signedjson' has no attribute 'sign_json'
Importing from top-level package instead of submodule.
fixUse: from signedjson.sign import sign_json
TypeError: verify_signed_json() missing 2 required positional arguments: 'algorithm' and 'key_version'
Passing only the signed JSON and key object; missing key.alg and key.version.
fixCall: verify_signed_json(signed_json, key.alg, key.version)
signedjson.key.InvalidSigningKeyError: Algorithm not supported: rsa
Attempting to sign with an RSA key or incorrect algorithm string.
fixOnly Ed25519 keys are supported. Use generate_signing_key() to create a valid key.
Upgrade
Version history
1.1.4latest on PyPI · released Mar 29, 2022
Audit
Dependencies
PyNaClrequiredEd25519 signing uses libsodium via PyNaCl
canonicaljsonrequiredEnsures canonical JSON encoding for consistent signatures