python-neva 0.6.0.dev1__tar.gz → 0.6.0.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/PKG-INFO +1 -1
  2. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/database/provider.py +0 -1
  3. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/__init__.py +3 -0
  4. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/config.py +1 -1
  5. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/hash_manager.py +0 -10
  6. python_neva-0.6.0.dev3/neva/security/tokens/__init__.py +5 -0
  7. python_neva-0.6.0.dev3/neva/security/tokens/token_hash.py +30 -0
  8. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/pyproject.toml +1 -1
  9. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/uv.lock +1 -1
  10. python_neva-0.6.0.dev1/neva/security/hashing/hashers/sha256.py +0 -42
  11. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/.envrc +0 -0
  12. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/.gitignore +0 -0
  13. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/.pre-commit-config.yaml +0 -0
  14. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/.python-version +0 -0
  15. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/README.md +0 -0
  16. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/__init__.py +0 -0
  17. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/arch/__init__.py +0 -0
  18. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/arch/app.py +0 -0
  19. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/arch/application.py +0 -0
  20. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/arch/config.py +0 -0
  21. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/arch/facade.py +0 -0
  22. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/arch/service_provider.py +0 -0
  23. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/config/__init__.py +0 -0
  24. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/config/base_providers.py +0 -0
  25. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/config/loader.py +0 -0
  26. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/config/provider.py +0 -0
  27. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/config/repository.py +0 -0
  28. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/console/__init__.py +0 -0
  29. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/console/kernel.py +0 -0
  30. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/console/runner.py +0 -0
  31. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/database/__init__.py +0 -0
  32. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/database/config.py +0 -0
  33. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/database/manager.py +0 -0
  34. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/database/repository.py +0 -0
  35. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/events/__init__.py +0 -0
  36. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/events/dispatcher.py +0 -0
  37. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/events/event.py +0 -0
  38. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/events/event_registry.py +0 -0
  39. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/events/interface.py +0 -0
  40. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/events/listener.py +0 -0
  41. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/__init__.py +0 -0
  42. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/logging/__init__.py +0 -0
  43. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/logging/manager.py +0 -0
  44. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/logging/provider.py +0 -0
  45. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/middleware/__init__.py +0 -0
  46. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/middleware/correlation.py +0 -0
  47. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/obs/middleware/profiler.py +0 -0
  48. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/py.typed +0 -0
  49. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/encryption/__init__.py +0 -0
  50. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/encryption/encrypter.py +0 -0
  51. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/encryption/protocol.py +0 -0
  52. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/__init__.py +0 -0
  53. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/hashers/__init__.py +0 -0
  54. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/hashers/argon2.py +0 -0
  55. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/hashers/bcrypt.py +0 -0
  56. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/hashing/hashers/protocol.py +0 -0
  57. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/security/provider.py +0 -0
  58. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/__init__.py +0 -0
  59. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/accessors.py +0 -0
  60. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/__init__.py +0 -0
  61. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/app.py +0 -0
  62. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/app.pyi +0 -0
  63. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/config.py +0 -0
  64. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/config.pyi +0 -0
  65. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/crypt.py +0 -0
  66. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/crypt.pyi +0 -0
  67. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/hash.py +0 -0
  68. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/hash.pyi +0 -0
  69. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/log.py +0 -0
  70. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/facade/log.pyi +0 -0
  71. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/results.py +0 -0
  72. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/strategy.py +0 -0
  73. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/strconv.py +0 -0
  74. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/support/time.py +0 -0
  75. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/testing/__init__.py +0 -0
  76. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/testing/fixtures.py +0 -0
  77. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/testing/http.py +0 -0
  78. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/neva/testing/test_case.py +0 -0
  79. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/ruff.toml +0 -0
  80. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/specifications/future_ideas.md +0 -0
  81. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/specifications/security.md +0 -0
  82. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/__init__.py +0 -0
  83. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/conftest.py +0 -0
  84. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/test_encrypter.py +0 -0
  85. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/test_example_usage.py +0 -0
  86. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/test_fixtures.py +0 -0
  87. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/test_hash_manager.py +0 -0
  88. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/test_scope.py +0 -0
  89. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/tests/test_test_case.py +0 -0
  90. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/architecture/01-overview.md +0 -0
  91. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/architecture/02-dependency-injection.md +0 -0
  92. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/architecture/03-service-providers.md +0 -0
  93. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/architecture/04-facades.md +0 -0
  94. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/architecture/05-application-lifecycle.md +0 -0
  95. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/architecture/06-result-option.md +0 -0
  96. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/configuration/01-overview.md +0 -0
  97. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/configuration/02-configuration-files.md +0 -0
  98. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/configuration/03-accessing-configuration.md +0 -0
  99. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/configuration/04-config-repository.md +0 -0
  100. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/configuration/05-loading-process.md +0 -0
  101. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/configuration/06-configuration-in-providers.md +0 -0
  102. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/testing/01-introduction.md +0 -0
  103. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/testing/02-test-case.md +0 -0
  104. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/testing/03-fixtures.md +0 -0
  105. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/testing/04-http-testing.md +0 -0
  106. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/testing/05-custom-configuration.md +0 -0
  107. {python_neva-0.6.0.dev1 → python_neva-0.6.0.dev3}/wiki/testing/06-test-isolation.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-neva
3
- Version: 0.6.0.dev1
3
+ Version: 0.6.0.dev3
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: cryptography>=46.0.3
@@ -25,7 +25,6 @@ class DatabaseServiceProvider(ServiceProvider):
25
25
  match Config.get("database"):
26
26
  case Ok(config):
27
27
  await Tortoise.init(config=config)
28
- await Tortoise.generate_schemas(safe=True)
29
28
  yield
30
29
  await Tortoise.close_connections()
31
30
  case Err(err):
@@ -3,6 +3,7 @@
3
3
  from neva.security.encryption import AesEncrypter, DecryptionError, Encrypter
4
4
  from neva.security.hashing import Argon2Hasher, BcryptHasher, HashManager, Hasher
5
5
  from neva.security.provider import SecurityProvider
6
+ from neva.security.tokens import hash_token, verify_token
6
7
 
7
8
  __all__ = [
8
9
  "AesEncrypter",
@@ -13,4 +14,6 @@ __all__ = [
13
14
  "HashManager",
14
15
  "Hasher",
15
16
  "SecurityProvider",
17
+ "hash_token",
18
+ "verify_token",
16
19
  ]
@@ -23,6 +23,6 @@ class Argon2Config(TypedDict):
23
23
  class HashingConfig(TypedDict):
24
24
  """Hasher config."""
25
25
 
26
- driver: Literal["argon2", "bcrypt", "sha256"]
26
+ driver: Literal["argon2", "bcrypt"]
27
27
  argon: NotRequired[Argon2Config]
28
28
  bcrypt: NotRequired[BcryptConfig]
@@ -8,7 +8,6 @@ from neva.config import ConfigRepository
8
8
  from neva.security.hashing.hashers.argon2 import Argon2Hasher
9
9
  from neva.security.hashing.hashers.bcrypt import BcryptHasher
10
10
  from neva.security.hashing.hashers.protocol import Hasher
11
- from neva.security.hashing.hashers.sha256 import Sha256Hasher
12
11
  from neva.support.strategy import StrategyResolver
13
12
 
14
13
 
@@ -25,7 +24,6 @@ class HashManager(StrategyResolver[Hasher]):
25
24
 
26
25
  _ = self.register("argon2", self._create_argon2_hasher)
27
26
  _ = self.register("bcrypt", self._create_bcrypt_hasher)
28
- _ = self.register("sha256", self._create_sha256_hasher)
29
27
 
30
28
  @override
31
29
  def default(self) -> Option[str]:
@@ -146,11 +144,3 @@ class HashManager(StrategyResolver[Hasher]):
146
144
  prefix=bcrypt_config.get("prefix", "2b"),
147
145
  )
148
146
  return BcryptHasher()
149
-
150
- def _create_sha256_hasher(self, _: StrategyResolver[Hasher]) -> Sha256Hasher:
151
- """Create an instance of the SHA256 hash strategy.
152
-
153
- Returns:
154
- Configured Sha256Hasher instance.
155
- """
156
- return Sha256Hasher()
@@ -0,0 +1,5 @@
1
+ """Token hashing utilities for secure token storage."""
2
+
3
+ from neva.security.tokens.token_hash import hash_token, verify_token
4
+
5
+ __all__ = ["hash_token", "verify_token"]
@@ -0,0 +1,30 @@
1
+ """Token hashing utilities."""
2
+
3
+ import hashlib
4
+ import hmac
5
+
6
+
7
+ def hash_token(token: str | bytes) -> str:
8
+ """Hash a secure random token for storage.
9
+
10
+ Args:
11
+ token: The token to hash.
12
+
13
+ Returns:
14
+ Hex-encoded hash of the token.
15
+ """
16
+ data = token.encode() if isinstance(token, str) else token
17
+ return hashlib.sha256(data).hexdigest()
18
+
19
+
20
+ def verify_token(token: str | bytes, hashed: str) -> bool:
21
+ """Verify a token against its stored hash.
22
+
23
+ Args:
24
+ token: The plaintext token to verify.
25
+ hashed: The stored hash to verify against.
26
+
27
+ Returns:
28
+ True if the token matches, False otherwise.
29
+ """
30
+ return hmac.compare_digest(hash_token(token), hashed)
@@ -7,7 +7,7 @@ packages = ["neva"]
7
7
 
8
8
  [project]
9
9
  name = "python-neva"
10
- version = "0.6.0.dev1"
10
+ version = "0.6.0.dev3"
11
11
  description = "Add your description here"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.12"
@@ -1267,7 +1267,7 @@ wheels = [
1267
1267
 
1268
1268
  [[package]]
1269
1269
  name = "python-neva"
1270
- version = "0.6.0.dev1"
1270
+ version = "0.6.0.dev3"
1271
1271
  source = { editable = "." }
1272
1272
  dependencies = [
1273
1273
  { name = "cryptography" },
@@ -1,42 +0,0 @@
1
- """SHA256 hasher."""
2
-
3
- import hashlib
4
- from typing import override
5
- from neva.security.hashing.hashers.protocol import Hasher
6
-
7
-
8
- def ensure_bytes(value: str | bytes) -> bytes:
9
- """Ensure the value is in bytes.
10
-
11
- Returns:
12
- the value in bytes
13
- """
14
- return value.encode() if isinstance(value, str) else value
15
-
16
-
17
- class Sha256Hasher(Hasher):
18
- """SHA256 hasher."""
19
-
20
- @override
21
- def make(
22
- self,
23
- plaintext: str | bytes,
24
- *,
25
- salt: bytes | None = None,
26
- ) -> str:
27
- return hashlib.sha256(ensure_bytes(plaintext)).hexdigest()
28
-
29
- @override
30
- def check(
31
- self,
32
- plaintext: str | bytes,
33
- hashed: str | bytes,
34
- ) -> bool:
35
- return hashlib.sha256(ensure_bytes(plaintext)).digest() == ensure_bytes(hashed)
36
-
37
- @override
38
- def needs_rehash(
39
- self,
40
- hashed: str | bytes,
41
- ) -> bool:
42
- return False