Server class
Operations the server / host performs to authenticate a user via SRP.
Designed to mimic the API of Python's pysrp library.
Constructors
- Server({required String userId, required Uint8List salt, required Uint8List verifierKey, BigInt? generator, BigInt? safePrime, HashFunctionChoice? hashFunction, HashFunction? customHashFunction})
- Creates a Server instance for SRP authentication.
Properties
- generator → BigInt
-
A generator modulo N.
Typically denoted 'g'.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hashFunctionChoice ↔ HashFunctionChoice?
-
Hash algorithm choice used during SRP key and verifier calculations (e.g., SHA256).
Null if using a custom hash function.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- safePrime → BigInt
-
A large, safe prime.
final
- sessionKey → Uint8List?
-
Shared symmetric session key derived during authentication.
no setter
Methods
-
createChallenge(
{Uint8List? ephemeralServerPrivateKeyBytes}) → Future< Challenge> - Creates an authentication challenge to send to the user.
-
deriveSessionKey(
{required Uint8List ephemeralUserPublicKey}) → Future< Uint8List> - Derives the session key from the user's ephemeral public key.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
verifySession(
{required Uint8List userSessionKeyVerifier, required Uint8List ephemeralUserPublicKey}) → Future< Uint8List> - Verifies the user's session and returns a server verifier for mutual authentication.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited