Fix pyrage passphrase API for v1.3.0

pyrage 1.3.0 removed the Recipient/Identity class pattern in favour of
pyrage.passphrase.encrypt(plaintext, passphrase) and
pyrage.passphrase.decrypt(ciphertext, passphrase) top-level functions.
Update _encrypt/_decrypt in config.py accordingly.

https://claude.ai/code/session_01KjaNo9RXevw6x1DjJD8mj6
This commit is contained in:
Claude
2026-03-24 21:39:49 +00:00
parent 052ec1f39e
commit 39846a95f2
+2 -4
View File
@@ -48,13 +48,11 @@ class ConfigError(Exception):
# ---------------------------------------------------------------------------
def _encrypt(plaintext: str, passphrase: str) -> bytes:
identity = pyrage.passphrase.Recipient(passphrase)
return pyrage.encrypt(plaintext.encode(), [identity])
return pyrage.passphrase.encrypt(plaintext.encode(), passphrase)
def _decrypt(ciphertext: bytes, passphrase: str) -> str:
identity = pyrage.passphrase.Identity(passphrase)
return pyrage.decrypt(ciphertext, [identity]).decode()
return pyrage.passphrase.decrypt(ciphertext, passphrase).decode()
# ---------------------------------------------------------------------------