isIdentityDescriptor function

bool isIdentityDescriptor(
  1. dynamic value
)

Type Guard for whether the unknown value is an IdentityDescriptor or not. @param value - value to type guard

Implementation

bool isIdentityDescriptor(
  dynamic value,
) {
  if (value is IdentityDescriptor) {
    switch (value.type) {
      case 'AnonymousIdentity':
        return true;
      case 'PublicKeyIdentity':
        if (value.publicKey! is String) {
          return false;
        }
        return true;
    }
  }
  return false;
}