private static bool VASPIsRegistered(
            VASPCredentialsRefAndHash vaspCredentialsRefAndHash)
        {
            var(@ref, hash) = vaspCredentialsRefAndHash;

            return(!(VASPCredentialsRef.IsEmpty(@ref) && VASPCredentialsHash.IsEmpty(hash)));
        }
 public VASPCredentialsRefAndHash(
     VASPCredentialsHash hash,
     VASPCredentialsRef @ref)
 {
     Hash = hash;
     Ref  = @ref;
 }
 public void Deconstruct(
     out VASPCredentialsRef @ref,
     out VASPCredentialsHash hash)
 {
     hash = Hash;
     @ref = Ref;
 }
 public static bool ValidateCredentialsOffline(
     string credentials,
     VASPCredentialsHash credentialsHash)
 {
     return(Multihash
            .Sum <KECCAK_256>(Encoding.UTF8.GetBytes(credentials)).Digest
            .SequenceEqual((byte[])credentialsHash));
 }
 public Task <bool> ValidateCredentialsAsync(
     string credentials,
     VASPCredentialsHash credentialsHash)
 {
     return(CallWithSimpleResultAsync
            (
                new ValidateCredentialsCall
     {
         CredentialsHash = credentialsHash,
         Credentials = credentials
     }
            ));
 }
        public override async Task <VASPCredentialsRefAndHash> GetCredentialsRefAndHashAsync(
            VASPId vaspId,
            ConfirmationLevel minimalConfirmationLevel = default)
        {
            var vaspCredentialsRefAndHash = await base.GetCredentialsRefAndHashAsync(vaspId, minimalConfirmationLevel);

            var(@ref, hash) = vaspCredentialsRefAndHash;

            if (VASPCredentialsRef.IsEmpty(@ref) != VASPCredentialsHash.IsEmpty(hash))
            {
                throw new Exception("Smart contract returned an unexpected combination of VASP credentials reference and hash.");
            }

            return(vaspCredentialsRefAndHash);
        }