ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

class HashManager(IHashManager): (source)

Constructor: HashManager(app)

View In Hierarchy

Expose an algorithm-agnostic hashing API.

Resolve the configured password hashing driver and delegate every operation to it, so application code never depends on a concrete algorithm.

Concurrency

No locks are used. The only mutable state is the driver cache, written the first time a driver is resolved: a concurrent first resolution from several threads may build the same driver twice, and the last write wins. Driver resolution is synchronous and never suspends, so tasks sharing an event loop never observe a partially built cache; only the hashing work itself is awaited on a worker thread. setRounds mutates the cached driver, and the provider binds this class as a singleton, so the change is visible to the whole application.

Method __init__ Initialize the manager from the application hashing configuration.
Method _build Instantiate the driver identified by name.
Async Method check Verify a plain text value against an encoded hash.
Method driver Return the hasher bound to the named (or default) driver.
Method getAlgorithm Return the algorithm identifier of the default driver.
Method getDefaultDriver Return the name of the configured default driver.
Async Method make Hash a plain text value with the default driver.
Method needsRehash Determine whether a hash was produced with outdated parameters.
Method setRounds Set the default cost factor used by the default driver.
Class Variable __slots__ Undocumented
Instance Variable _config Undocumented
Instance Variable _default Undocumented
Instance Variable _drivers Undocumented
def __init__(self, app: IApplication): (source)

Initialize the manager from the application hashing configuration.

A missing hashing section falls back to the defaults declared by the configuration entity.

Parameters
app:IApplicationApplication container used to read the configuration.
Returns
NoneThis method initializes the instance and returns None.
def _build(self, name: str) -> IHasher: (source)

Instantiate the driver identified by name.

Parameters
name:strDriver name to build.
Returns
IHasherConfigured hasher instance.
Raises
HashDriverNotSupportedExceptionIf name does not match any supported driver.
async def check(self, value: str, hashed: str) -> bool: (source)

Verify a plain text value against an encoded hash.

The verification runs on a worker thread, so the event loop stays free while the hash is recomputed.

Parameters
value:strPlain text value to verify.
hashed:strPreviously generated hash.
Returns
boolTrue when the value matches the hash, False otherwise.
def driver(self, name: str | None = None) -> IHasher: (source)

Return the hasher bound to the named (or default) driver.

Parameters
name:str | NoneDriver name ('argon2' or 'bcrypt'). None selects the configured default driver.
Returns
IHasherHasher instance for the requested driver, created on first access and cached afterwards.
Raises
HashDriverNotSupportedExceptionIf the requested driver is not supported.
def getAlgorithm(self) -> str: (source)

Return the algorithm identifier of the default driver.

Returns
strAlgorithm identifier, such as 'argon2id' or 'bcrypt'.
def getDefaultDriver(self) -> str: (source)

Return the name of the configured default driver.

Returns
strDriver name, such as 'argon2' or 'bcrypt'.
async def make(self, value: str, *, rounds: int | None = None, memory: int | None = None, threads: int | None = None) -> str: (source)

Hash a plain text value with the default driver.

The hashing work runs on a worker thread, so the event loop stays free while the cost parameters are burned.

Parameters
value:strPlain text value to hash.
rounds:int | NonePer-call cost override.
memory:int | NonePer-call memory cost override, in kibibytes.
threads:int | NonePer-call parallelism override.
Returns
strEncoded hash produced by the default driver.
def needsRehash(self, hashed: str) -> bool: (source)

Determine whether a hash was produced with outdated parameters.

Parameters
hashed:strPreviously generated hash.
Returns
boolTrue when the hash should be regenerated with the current configuration.
def setRounds(self, rounds: int) -> Self: (source)

Set the default cost factor used by the default driver.

Parameters
rounds:intNew cost factor.
Returns
SelfThe same manager instance, allowing fluent configuration.
Raises
HashConfigurationExceptionIf the value is not valid for the active driver.
_config: _HashingConfig = (source)

Undocumented

_default: str = (source)

Undocumented

_drivers: dict[str, IHasher] = (source)

Undocumented