lookupPubKey method

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

Implementation

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

  final cacheValue = pubKeyCache[_cacheKey(atSign, enrollmentId)];
  if (cacheValue == null) return null;

  if (publicKeyCacheSettings!.resetOnLookup) {
    // Cancel the existing timer and create a new one
    cacheValue.$2.cancel();
    final timer = Timer(publicKeyCacheSettings!.cacheExpiry, () {
      pubKeyCache.remove(_cacheKey(atSign, enrollmentId));
    });
    pubKeyCache[_cacheKey(atSign, enrollmentId)] = (cacheValue.$1, timer);
  }
  return cacheValue.$1;
}