loadNip05 method

  1. @override
Future<Nip05?> loadNip05({
  1. String? pubKey,
  2. String? identifier,
})
override

Implementation

@override
Future<Nip05?> loadNip05({String? pubKey, String? identifier}) async {
  if (pubKey != null) {
    final data = await _nip05Store.record(pubKey).get(_database);
    if (data == null) return null;
    return Nip05Extension.fromJsonStorage(data);
  }
  if (identifier != null) {
    final finder = sembast.Finder(
      filter: sembast.Filter.equals('nip05', identifier),
    );
    final record = await _nip05Store.findFirst(_database, finder: finder);
    if (record == null) return null;
    return Nip05Extension.fromJsonStorage(record.value);
  }
  return null;
}