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

What the server knows about players: the approvals of unpaired ones and the pairing credentials, over one store. More...

Inheritance diagram for de.yaacc.sendspin.SendspinPolicy:
Inheritance graph
Collaboration diagram for de.yaacc.sendspin.SendspinPolicy:
Collaboration graph

Classes

enum  PairOutcome
 What pasting a token did. More...
 

Public Member Functions

 SendspinPolicy (StringSetStore store)
 
ServerHandshake.PskChoice pskFor (String clientId)
 The PSK to reference for this player: its Pairing PSK if the operator pasted a token (the operator means to pair), else its long-term PSK if it is paired, else the Sentinel.
 
byte[] pairingPsk (String clientId)
 The Pairing PSK from a token the operator pasted for this player, or null.
 
boolean isPaired (String clientId)
 
synchronized boolean completePairing (String clientId, byte[] longTermPsk)
 Records a pairing the player has just finished: stores its new long-term PSK, drops the token and the approval (spec: an approval is discarded on a successful pairing).
 
void unpair (String clientId)
 Forgets the pairing and any token of this player.
 
boolean isApproved (String clientId)
 
void approve (String clientId)
 
void revoke (String clientId)
 
boolean addToken (PairingToken token)
 The operator pastes a token: the next connection to its player references the Pairing PSK.
 
void removeToken (String clientId)
 
List< String > pairedIds ()
 
List< String > approvedIds ()
 
PairOutcome addDeviceToken (String text)
 The operator enters the token of a device before it connects (the settings' "Add device", by text or by scanning its QR code): the token is kept under the key it carries, so the device's next connection references the Pairing PSK and is paired, for whatever role it comes in.
 
PairOutcome pairWithToken (String text, String connectedClientId)
 The operator pastes a token for a player.
 
- Public Member Functions inherited from de.yaacc.sendspin.hub.ServerPolicy

Detailed Description

What the server knows about players: the approvals of unpaired ones and the pairing credentials, over one store.

Member Function Documentation

◆ addDeviceToken()

PairOutcome de.yaacc.sendspin.SendspinPolicy.addDeviceToken ( String text)

The operator enters the token of a device before it connects (the settings' "Add device", by text or by scanning its QR code): the token is kept under the key it carries, so the device's next connection references the Pairing PSK and is paired, for whatever role it comes in.

There is no connection to check the key against yet; the PSK only works for the key it belongs to.

Referenced by de.yaacc.sendspin.SendspinHub.addDeviceToken().

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

◆ addToken()

boolean de.yaacc.sendspin.SendspinPolicy.addToken ( PairingToken token)

The operator pastes a token: the next connection to its player references the Pairing PSK.

Returns
false if there is no room
Here is the call graph for this function:

◆ approve()

void de.yaacc.sendspin.SendspinPolicy.approve ( String clientId)

◆ completePairing()

synchronized boolean de.yaacc.sendspin.SendspinPolicy.completePairing ( String clientId,
byte[] longTermPsk )

Records a pairing the player has just finished: stores its new long-term PSK, drops the token and the approval (spec: an approval is discarded on a successful pairing).

Returns
false if the PSK is not fit to keep (the Sentinel, the pairing PSK, a wrong length) or there is no room

Implements de.yaacc.sendspin.hub.ServerPolicy.

Here is the call graph for this function:

◆ isApproved()

boolean de.yaacc.sendspin.SendspinPolicy.isApproved ( String clientId)

◆ isPaired()

boolean de.yaacc.sendspin.SendspinPolicy.isPaired ( String clientId)

◆ pairingPsk()

byte[] de.yaacc.sendspin.SendspinPolicy.pairingPsk ( String clientId)

The Pairing PSK from a token the operator pasted for this player, or null.

Implements de.yaacc.sendspin.hub.ServerPolicy.

◆ pairWithToken()

PairOutcome de.yaacc.sendspin.SendspinPolicy.pairWithToken ( String text,
String connectedClientId )

The operator pastes a token for a player.

Parameters
connectedClientIdthe id the player presented on its connection, null if there is none yet

Referenced by de.yaacc.sendspin.SendspinHub.pair().

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

◆ pskFor()

ServerHandshake.PskChoice de.yaacc.sendspin.SendspinPolicy.pskFor ( String clientId)

The PSK to reference for this player: its Pairing PSK if the operator pasted a token (the operator means to pair), else its long-term PSK if it is paired, else the Sentinel.

Implements de.yaacc.sendspin.hub.ServerPolicy.

◆ revoke()

void de.yaacc.sendspin.SendspinPolicy.revoke ( String clientId)

◆ unpair()

void de.yaacc.sendspin.SendspinPolicy.unpair ( String clientId)

Forgets the pairing and any token of this player.

Implements de.yaacc.sendspin.hub.ServerPolicy.

Referenced by de.yaacc.sendspin.SendspinHub.unpair().

Here is the caller graph for this function:

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