diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_recovery_key.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_recovery_key.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/meshbay-hub/tests/test_recovery_key.py b/packages/meshbay-hub/tests/test_recovery_key.py index 54415f6..c574597 100644 --- a/packages/meshbay-hub/tests/test_recovery_key.py +++ b/packages/meshbay-hub/tests/test_recovery_key.py @@ -84,10 +84,11 @@ const fp = async (key) => hex(await webcrypto.subtle.encrypt( const kB = await K.deriveRecoveryKey(raw, 'acc-B'); const skEd = new Uint8Array([1, 2, 3]); const skX = new Uint8Array([4, 5, 6]); - const blob = await K.encryptBundleWithKey(skEd, skX, kA); + const sealedFor = { userId: 'acc-A', nodePk: 'node-key' }; + const blob = await K.encryptBundle(skEd, skX, kA, { ...sealedFor, pepperVersion: 0 }); let wrongRejected = false; - try { await K.decryptBundleWithKey(blob, kB); } catch { wrongRejected = true; } - const opened = await K.decryptBundleWithKey(blob, kA); + try { await K.decryptBundle(blob, kB, sealedFor); } catch { wrongRejected = true; } + const opened = await K.decryptBundle(blob, kA, sealedFor); out.recovery_wrap_isolates = wrongRejected && opened.skEd === btoa(String.fromCharCode(1, 2, 3)) && opened.skX === btoa(String.fromCharCode(4, 5, 6)); @@ -102,10 +103,10 @@ const fp = async (key) => hex(await webcrypto.subtle.encrypt( def result(tmp_path_factory): d = tmp_path_factory.mktemp("recovery") harness = d / "harness.cjs" - harness.write_text(_HARNESS) + harness.write_text(_HARNESS, encoding="utf-8") proc = subprocess.run( ["node", str(harness), str(KEYDERIVE)], - capture_output=True, text=True, timeout=120, + capture_output=True, text=True, encoding="utf-8", timeout=120, ) if proc.returncode != 0: pytest.fail(f"node harness failed:\n{proc.stderr[-2000:]}") |