YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.pairing.CodePairingServer Class Reference

The server's side (role A) of the code-based pairing (issue #325, task 11.1; spec, "Dynamic Pairing Code Flow" and "Static Pairing Code Flow"): the operator chose a method for a player, the player shows or knows a code, the operator types it (or scans its QR code), a CPace run authenticates both sides and the player delivers a new long-term PSK sealed under the key of the run. More...

Collaboration diagram for de.yaacc.sendspin.pairing.CodePairingServer:
Collaboration graph

Classes

enum  Failure
 
enum  Method
 What the operator chose. More...
 
enum  State
 

Public Member Functions

 CodePairingServer (NoiseSuite suite, byte[] h, int pairingIndex, Method method, SecureRandom random, PairingPort port)
 
synchronized State state ()
 
synchronized Failure failure ()
 
synchronized int round ()
 The round of a dynamic attempt (1 for the first); 1 in a static attempt.
 
Method method ()
 
synchronized String deviceMessage ()
 The sentence the player sent while it holds back (shown as the device's, not as the app's), or null.
 
synchronized byte[] takePsk ()
 The new long-term PSK once, after State#DONE; then null.
 
synchronized void start () throws IOException
 Sends the activation that names the method.
 
synchronized boolean provideCode (String text) throws IOException
 The operator's entry: the typed code (the dynamic digits, or the static digits) or, for the QR format, the scanned or pasted token.
 
synchronized void onMessage (String type, JSONObject payload) throws IOException, ProtocolException
 One message of the player.
 
synchronized void cancel () throws IOException
 The operator gave up.
 
synchronized byte[] sessionKeyForTests ()
 

Static Public Attributes

static final int ROUND_LIMIT = 20
 The most rounds of one attempt.
 

Detailed Description

The server's side (role A) of the code-based pairing (issue #325, task 11.1; spec, "Dynamic Pairing Code Flow" and "Static Pairing Code Flow"): the operator chose a method for a player, the player shows or knows a code, the operator types it (or scans its QR code), a CPace run authenticates both sides and the player delivers a new long-term PSK sealed under the key of the run.

A pure state machine: the connection feeds it the messages of the player and the operator's entry and gives it a PairingPort; it never touches the socket. A violation of the sequence or of a value is a ProtocolException (the connection closes). Methods are synchronized: the operator's entry comes from another thread.

Member Function Documentation

◆ provideCode()

synchronized boolean de.yaacc.sendspin.pairing.CodePairingServer.provideCode ( String text) throws IOException

The operator's entry: the typed code (the dynamic digits, or the static digits) or, for the QR format, the scanned or pasted token.

Accepted only when the attempt waits for it (a static code may also be given before the player has started).

Returns
false if the entry is malformed or not wanted now (the attempt waits for another)

Referenced by de.yaacc.sendspin.hub.HubConnection.submitCode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ takePsk()

synchronized byte[] de.yaacc.sendspin.pairing.CodePairingServer.takePsk ( )

The new long-term PSK once, after State#DONE; then null.

The caller zeroes it.


The documentation for this class was generated from the following file: