Spake2Context class
BoringSSL-compatible SPAKE2 implementation over the Ed25519 group.
Used by the ADB wireless pairing protocol (Android 11+) for password-authenticated key exchange with a 6-digit pairing code.
Usage:
final ctx = Spake2Context.forPairing(role: Spake2Role.alice);
final myMsg = ctx.generateMessage(utf8.encode(pairingCode));
// Send myMsg to peer, receive theirMsg
final sharedKey = ctx.processMessage(theirMsg);
Constructors
- Spake2Context(Spake2Role _role, Uint8List _myName, Uint8List _theirName, {Spake2RandomBytesSource? randomBytesSource})
- Spake2Context.forPairing({required Spake2Role role, Spake2RandomBytesSource? randomBytesSource})
-
Creates a SPAKE2 context pre-configured for ADB pairing.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- myMessage → Uint8List
-
no setter
- myName → Uint8List
-
no setter
- passwordHash → Uint8List
-
no setter
- passwordScalar → Uint8List
-
no setter
- privateKey → Uint8List
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
no setter
- theirName → Uint8List
-
no setter
Methods
-
generateMessage(
Uint8List password) → Uint8List - Generates the SPAKE2 message to send to the peer.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processMessage(
Uint8List theirMessage, {bool verbose = false}) → Uint8List - Processes the peer's SPAKE2 message and derives the shared key.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited