Skip to content

Commit

Permalink
fix: project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi committed May 28, 2023
1 parent 28fddbd commit fa26556
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 5 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/phase.py → src/phase/phase.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import re
from nacl.bindings import crypto_kx_server_session_keys, crypto_kx_client_session_keys
from dataclasses import dataclass
from src.utils.crypto import decrypt_b64, encrypt_b64, fetch_app_key, random_key_pair, reconstruct_secret
from src.version import __version__, __ph_version__
from .utils.crypto import decrypt_b64, encrypt_b64, fetch_app_key, random_key_pair, reconstruct_secret
from .version import __version__, __ph_version__


@dataclass
Expand Down
Empty file added src/phase/utils/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/test_decrypt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from src.phase import Phase
from src.phase.phase import Phase

APP_ID = "phApp:v1:e0e50cb9a1953c610126b4092093b1beca51d08d91fc3d9f8d90482a32853215"
APP_SECRET = "pss:v1:d261abecb6708c18bebdb8b2748ee574e2b0bdeaf19b081a5f10006cc83d48d0:d146c8c6d326a7842ff9b2da0da455b3f7f568a70808e2eb0cfc5143d4fe170f:59e413612e06d75d251e3416361d0743345a9c9eda1cbcf2b1ef16e3077c011c"
Expand All @@ -18,7 +18,7 @@ def mock_fetch_app_key(appToken, wrapKey, appId, dataSize):
def test_phase_decrypt_returns_correct_plaintext(phase_instance, monkeypatch):
data = "Signal"

monkeypatch.setattr("src.phase.fetch_app_key", mock_fetch_app_key)
monkeypatch.setattr("src.phase.phase.fetch_app_key", mock_fetch_app_key)

ciphertext = phase_instance.encrypt(data)

Expand All @@ -31,7 +31,7 @@ def test_phase_decrypt_returns_correct_plaintext(phase_instance, monkeypatch):
def test_phase_decrypt_fails_with_incorrect_app_secret(monkeypatch):
phase = Phase(APP_ID, APP_SECRET_INVALID)

monkeypatch.setattr("src.phase.fetch_app_key", mock_fetch_app_key)
monkeypatch.setattr("src.phase.phase.fetch_app_key", mock_fetch_app_key)

data = "Signal"
ciphertext = phase.encrypt(data)
Expand Down

0 comments on commit fa26556

Please sign in to comment.