getAccounts method

Iterable<SetonixAccount> getAccounts()

Implementation

Iterable<SetonixAccount> getAccounts() sync* {
  const kKeySuffix = '.key';
  final privateKeys = getAssets(
    '$kPackAccountsPath/',
    true,
  ).where((e) => e.endsWith(kKeySuffix));
  for (final path in privateKeys) {
    final name = path.substring(0, path.length - kKeySuffix.length);
    final privateKey = getAsset(path);
    if (privateKey == null) continue;
    final publicKey = getAsset('$kPackAccountsPath/$name.pub');
    if (publicKey == null) continue;
    yield SetonixAccount(
      privateKey: privateKey,
      publicKey: publicKey,
      name: name,
    );
  }
}