validateKey method
void
validateKey()
inherited
Validates the AtKey
Throws InvalidAtKeyException when the following conditions are met
Implementation
void validateKey() {
if (atKey.metadata.isCached == true && atKey.isLocal == true) {
throw InvalidAtKeyException('Cached key cannot be a local key');
}
if (atKey.isLocal == true &&
(atKey.metadata.isPublic == true ||
atKey.sharedWith.isNotNullOrEmpty)) {
throw InvalidAtKeyException(
'When isLocal is set to true, cannot set isPublic to true or set a non-null sharedWith');
}
if (atKey.metadata.isPublic == true && atKey.sharedWith.isNotNullOrEmpty) {
throw InvalidAtKeyException(
'When isPublic is set to true, sharedWith cannot be populated');
}
if (atKey.key.isNullOrEmpty) {
throw InvalidAtKeyException('Key cannot be null or empty');
}
}