getKeys method

  1. @override
Future<List<String>> getKeys({
  1. String? regex,
  2. String? sharedBy,
  3. String? sharedWith,
  4. bool showHiddenKeys = false,
})
override

Get all the keys stored in user's secondary in string format. If regex is specified only matching keys are returned. If sharedBy is specified, then gets the keys from sharedBy user shared with current atClient user. If sharedWith is specified, then gets the keys shared to sharedWith user from the current atClient user.

e.g alice is the current atsign
 scan
  getKeys();
 scan .persona
  getKeys(regex:'.persona');
 scan:@bob
  getKeys(sharedBy:'@bob');

Implementation

@override
Future<List<String>> getKeys(
    {String? regex,
    String? sharedBy,
    String? sharedWith,
    bool showHiddenKeys = false}) async {
  var builder = ScanVerbBuilder()
    ..sharedWith = sharedWith
    ..sharedBy = sharedBy
    ..regex = regex
    ..showHiddenKeys = showHiddenKeys
    ..auth = true;
  var scanResult = await getSecondary().executeVerb(builder);
  scanResult = _formatResult(scanResult);
  var result = [];
  if (scanResult.isNotEmpty) {
    result = List<String>.from(jsonDecode(scanResult));
  }
  return result as FutureOr<List<String>>;
}