encrypt_self
This commit is contained in:
parent
131896b1c2
commit
3aa452ff72
@ -5,7 +5,7 @@ from nacl.signing import SigningKey, VerifyKey, SignedMessage
|
||||
|
||||
from v6d0auth.config import myroot, cakey
|
||||
|
||||
__all__ = ('vkey', 'pkey', 'averify')
|
||||
__all__ = ('vkey', 'pkey', 'averify', 'receive')
|
||||
|
||||
_keyfile = myroot / '.key'
|
||||
if _keyfile.exists():
|
||||
@ -27,6 +27,10 @@ def verify(data: bytes, signature: Optional[bytes] = None) -> bytes:
|
||||
return vkey.verify(data, signature)
|
||||
|
||||
|
||||
def encrypt_self(data: bytes) -> bytes:
|
||||
return SealedBox(pkey).encrypt(data)
|
||||
|
||||
|
||||
def receive(data: bytes) -> bytes:
|
||||
return SealedBox(_ekey).decrypt(data)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user