LoginExchange
extends OpaqueExchange
in package
One in-flight login (CONTRACT.md §23).
Table of Contents
Methods
- __construct() : mixed
- Adopts `$handle`, which this exchange now owns and must release exactly once — through `finish`, `close()` or the destructor, whichever comes first.
- __destruct() : mixed
- Releases an exchange the caller abandoned — a login started and never completed. PHP's refcounting makes that prompt rather than eventual.
- close() : void
- Releases the exchange if it was never finished.
- finish() : string
- Opens the envelope, producing `KE3`.
- ke1() : string
- The hex `KE1` to send to `login/start`.
Methods
__construct()
Adopts `$handle`, which this exchange now owns and must release exactly once — through `finish`, `close()` or the destructor, whichever comes first.
public
__construct(OpaqueNativeInterface $lib, mixed $handle, string $firstMessage) : mixed
Parameters
- $lib : OpaqueNativeInterface
- $handle : mixed
- $firstMessage : string
__destruct()
Releases an exchange the caller abandoned — a login started and never completed. PHP's refcounting makes that prompt rather than eventual.
public
__destruct() : mixed
close()
Releases the exchange if it was never finished.
public
close() : void
Idempotent, and a no-op once finish has spent the handle. Calling it is optional —
__destruct does the same thing — but an application that knows the exchange is over
should not wait for a refcount to say so.
finish()
Opens the envelope, producing `KE3`.
public
finish(string $password, string $ke2, KsfParams $ksf) : string
A failure here is the whole of the client's authentication check, and covers both
halves of the mutual authentication: the envelope only opens under the right password, and
KE2's MAC only verifies if the server actually holds the record. Nothing may be sent
afterwards (§23.4 rule 7).
That case is an AuthError, unlike every other refusal in this package. The distinction is the point: a wrong password, an account that does not exist and a server that does not hold the record are indistinguishable by design and are all authentication failures, whereas a key-stretching function this build cannot perform is a configuration problem, and reporting it as "invalid password" would send an operator looking in the wrong place.
Parameters
- $password : string
- $ke2 : string
- $ksf : KsfParams
Tags
Return values
stringke1()
The hex `KE1` to send to `login/start`.
public
ke1() : string