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