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:
+2
-4
@@ -48,13 +48,11 @@ class ConfigError(Exception):
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
def _encrypt(plaintext: str, passphrase: str) -> bytes:
|
def _encrypt(plaintext: str, passphrase: str) -> bytes:
|
||||||
identity = pyrage.passphrase.Recipient(passphrase)
|
return pyrage.passphrase.encrypt(plaintext.encode(), passphrase)
|
||||||
return pyrage.encrypt(plaintext.encode(), [identity])
|
|
||||||
|
|
||||||
|
|
||||||
def _decrypt(ciphertext: bytes, passphrase: str) -> str:
|
def _decrypt(ciphertext: bytes, passphrase: str) -> str:
|
||||||
identity = pyrage.passphrase.Identity(passphrase)
|
return pyrage.passphrase.decrypt(ciphertext, passphrase).decode()
|
||||||
return pyrage.decrypt(ciphertext, [identity]).decode()
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user