handleAGENTC_SIGN_REQUEST method

void handleAGENTC_SIGN_REQUEST(
  1. Channel channel,
  2. AGENTC_SIGN_REQUEST msg
)

Signs challenge authenticating a descendent channel.

Implementation

void handleAGENTC_SIGN_REQUEST(Channel channel, AGENTC_SIGN_REQUEST msg) {
  if (tracePrint != null) {
    tracePrint('$hostport: agent channel: AGENTC_SIGN_REQUEST');
  }
  SerializableInput keyStream = SerializableInput(msg.key);
  String keyType = deserializeString(keyStream);
  Uint8List sig =
      identity.signMessage(Key.id(keyType), msg.data, getSecureRandom());
  if (sig != null) {
    sendToChannel(channel, AGENT_SIGN_RESPONSE(sig).toRaw());
  } else {
    sendToChannel(channel, AGENT_FAILURE().toRaw());
  }
}