User class
Operations the user / client performs to register and authenticate with a server via SRP.
Once authentication is complete, store the session key somewhere, then ensure sensitive information in the User object is erased by allowing the garbage collector to delete the object (i.e., allow all references to the object to go out of scope and/or be set to null). The object internally attempts to delete data as soon as it is no longer needed.
Designed to mimic the API of Python's pysrp library.
Properties
- generator → BigInt
-
A generator modulo N (the safe prime).
Typically denoted 'g'.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- safePrime → BigInt
-
A large, safe prime.
Typically denoted 'N'.
By definition a safe prime N = 2q + 1, where q is a Sophie Germain prime.
All arithmetic is performed in the field of integers modulo N.
final
- sessionKey → Uint8List
-
Shared symmetric session key derived during authentication.
no setter
- useUserIdInPrivateKey → bool
-
If true, use user ID along with password in KDF to generate user private
key. Otherwise only the password is used.
final
Methods
-
getUserSessionVerifiers(
) → UserSessionVerifiers - Retrieves user session verifiers to send to server for authentication.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
verifySession(
Uint8List serverSessionKeyVerifier) → Future< void> - Verifies the server's identity by checking the server session key verifier.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
createSaltedVerificationKey(
{required String password, String? userId, BigInt? generator, BigInt? safePrime, KdfChoice? kdf, Kdf? customKdf, Uint8List? salt}) → Future< SaltedVerificationKey> - Creates a salted verification key.
-
createSaltedVerificationKeyFromBytes(
{required Uint8List passwordBytes, Uint8List? userIdBytes, BigInt? generator, BigInt? safePrime, KdfChoice? kdf, Kdf? customKdf, Uint8List? salt}) → Future< SaltedVerificationKey> - Creates a salted verification key from byte arrays.
-
fromUserCredsAndChallenge(
{required String userId, required String password, required Challenge challenge, bool useUserIdInPrivateKey = true, KdfChoice? kdf, Kdf? customKdf, Uint8List? ephemeralUserPrivateKey}) → Future< User> -
As part of initial user authentication handshake, create a User from a
challenge
provided by the server. -
fromUserCredsBytesAndChallenge(
{required Uint8List userIdBytes, required Uint8List passwordBytes, required Challenge challenge, bool useUserIdInPrivateKey = true, HashFunction? customHashFunction, KdfChoice? kdf, Kdf? customKdf, Uint8List? ephemeralUserPrivateKey}) → Future< User> -
As part of initial user authentication handshake, create a User from a
challenge
provided by the server.