PeripheralHandshake

class PeripheralHandshake(staticKey: PrivateKey, ephemeral: KeyPair = P256.generate(), nonce: ByteArray = ByteArray(16).also { SecureRandom().nextBytes(it) })(source)

Peripheral (Android) side of the handshake. staticKey may be an AndroidKeyStore key. staticPublic is its X9.63 encoding.

Constructors

Link copied to clipboard
constructor(staticKey: PrivateKey, ephemeral: KeyPair = P256.generate(), nonce: ByteArray = ByteArray(16).also { SecureRandom().nextBytes(it) })

Properties

Link copied to clipboard
var hello: Hello?
Link copied to clipboard

Functions

Link copied to clipboard

Verifies the central's FIN; returns the session and our FIN.

Link copied to clipboard
fun receiveHello(r: Record, paired: ByteArray?, token: ByteArray?): Record

fun receiveHello(r: Record, isKnown: (ByteArray) -> Boolean, token: ByteArray?): Record

isKnown says whether a static key belongs to one of the paired centrals (iPhone, Mac…).

fun receiveHello(r: Record, isKnown: (ByteArray) -> Boolean, tokenFor: (ByteArray) -> ByteArray?): Record

tokenFor gives the pairing token a pair-mode HELLO from that static key must prove (null: pairing closed).