getCurrentPubKey method

Future<String> getCurrentPubKey()

Returns currently used public key for Ed25519 signer.

Implementation

Future<String> getCurrentPubKey() async {
  var isCorrectUuid =
      await _channel.invokeMethod('checkUuid', {'uuid': uuid});
  if (isCorrectUuid) {
    var key =
        await _channel.invokeMethod("readData", {'key': "${uuid}_0_pub"});
    if (Platform.isWindows || Platform.isAndroid) {
      var codec = const Base64Codec();
      var encodeKey = codec.decode(key);
      var urlCodec = const Base64Codec.urlSafe();
      var urlSafeKey = urlCodec.encode(encodeKey);
      return urlSafeKey;
    } else {
      return key;
    }
  } else {
    throw IncorrectUuidException(
        'There are no keys associated with this UUID saved on the device');
  }
}