acceptSecureSession method
The accepting side of a link: consumes the initiator's firstMessage
under me. The session is open at once; send its handshakeMessage back.
Throws with AviaryStatus.badInput when the initiator does not verify.
Implementation
SecureSession acceptSecureSession(SecureIdentity me, Uint8List firstMessage) {
final k = me.kem;
final g = me.sig;
final f = lib
.fn<_SecAcceptC>('aviary_secure_accept')
.asFunction<_SecAcceptD>();
final parts = [k.public, k.secret, g.public, g.secret, firstMessage];
final n = parts.map((b) => b.length).toList();
return _scoped(parts, (p) {
final h = f(p[0], n[0], p[1], n[1], p[2], n[2], p[3], n[3], p[4], n[4]);
if (h == nullptr) {
throw const AviaryException(
'secure session refused',
AviaryStatus.badInput,
);
}
return SecureSession._(this, h);
});
}