feat: add complete yiyezhqiu productivity suite
This commit is contained in:
commit
e422ca8b2a
155 files changed
+18959
No files matched your search
@@ -0,0 +1,19 @@
|
||||
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
||||
|
||||
|
||||
def test_sha256_file_and_ed25519_verification(tmp_path):
|
||||
from dx_productivity.update.verification import sha256_file, verify_ed25519
|
||||
|
||||
payload = b"release payload"
|
||||
path = tmp_path / "payload.bin"
|
||||
path.write_bytes(payload)
|
||||
private_key = Ed25519PrivateKey.generate()
|
||||
signature = private_key.sign(payload)
|
||||
|
||||
assert sha256_file(path) == "d11a02dfb3d8dfdc9229678b67f948c32aabeb9e5d409434b171cd7e5275774f"
|
||||
assert verify_ed25519(
|
||||
private_key.public_key().public_bytes_raw(), payload, signature
|
||||
)
|
||||
assert not verify_ed25519(
|
||||
private_key.public_key().public_bytes_raw(), b"changed", signature
|
||||
)
|
||||
Reference in new issue
Block a user