lookupPubKey method

  1. @visibleForTesting
String? lookupPubKey(
  1. String atSign,
  2. String enrollmentId
)

Implementation

@visibleForTesting
String? lookupPubKey(String atSign, String enrollmentId) {
  if (publicKeyCacheSettings == null) return null;

  final key = _cacheKey(atSign, enrollmentId);
  final cacheValue = pubKeyCache[key];
  if (cacheValue == null) return null;
  if (!DateTime.now().isBefore(cacheValue.$2)) {
    pubKeyCache.remove(key);
    return null;
  }
  return cacheValue.$1;
}