/// <inheritdoc />
        public virtual async Task <bool> VerifyProofAsync(IAgentContext agentContext, string proofRequestJson, string proofJson, bool validateEncoding = true)
        {
            var proof        = JsonConvert.DeserializeObject <PartialProof>(proofJson);
            var proofRequest = proofRequestJson.ToObject <ProofRequest>();

            // If any values are revealed, validate encoding
            // against expected values
            if (validateEncoding && proof.RequestedProof.RevealedAttributes != null)
            {
                foreach (var attribute in proof.RequestedProof.RevealedAttributes)
                {
                    if (!CredentialUtils.CheckValidEncoding(attribute.Value.Raw, attribute.Value.Encoded))
                    {
                        throw new AriesFrameworkException(ErrorCode.InvalidProofEncoding,
                                                          $"The encoded value for '{attribute.Key}' is invalid. " +
                                                          $"Expected '{CredentialUtils.GetEncoded(attribute.Value.Raw)}'. " +
                                                          $"Actual '{attribute.Value.Encoded}'");
                    }
                }
            }

            var schemas = await BuildSchemasAsync(agentContext,
                                                  proof.Identifiers
                                                  .Select(x => x.SchemaId)
                                                  .Where(x => x != null)
                                                  .Distinct());

            var definitions = await BuildCredentialDefinitionsAsync(agentContext,
                                                                    proof.Identifiers
                                                                    .Select(x => x.CredentialDefintionId)
                                                                    .Where(x => x != null)
                                                                    .Distinct());

            var revocationDefinitions = await BuildRevocationRegistryDefinitionsAsync(agentContext,
                                                                                      proof.Identifiers
                                                                                      .Select(x => x.RevocationRegistryId)
                                                                                      .Where(x => x != null)
                                                                                      .Distinct());

            var revocationRegistries = await BuildRevocationRegistriesAsync(
                agentContext,
                proof.Identifiers.Where(x => x.RevocationRegistryId != null));

            return(await AnonCreds.VerifierVerifyProofAsync(
                       proofRequestJson,
                       proofJson,
                       schemas,
                       definitions,
                       revocationDefinitions,
                       revocationRegistries));
        }
        public void ValidateEncoding()
        {
            var raw     = "SLC";
            var encoded = "101327353979588246869873249766058188995681113722618593621043638294296500696424";
            var valid   = CredentialUtils.CheckValidEncoding(raw, encoded);

            Assert.True(valid);

            raw     = "SLC";
            encoded = "invalid";
            valid   = CredentialUtils.CheckValidEncoding(raw, encoded);
            Assert.False(valid);

            raw     = "2147483648";
            encoded = "26221484005389514539852548961319751347124425277437769688639924217837557266135";
            valid   = CredentialUtils.CheckValidEncoding(raw, encoded);
            Assert.True(valid);
        }