public JToken CreateProof(CreateProofOptions options, JsonLdProcessorOptions processorOptions)
        {
            var(document, proofs) = options.Document.GetProofs(processorOptions);
            var proof = new BbsBlsSignature2020(proofs.FirstOrDefault() ?? throw new Exception("Proof not found"));

            proof.Context = Constants.SECURITY_CONTEXT_V2_URL;

            var signature    = Convert.FromBase64String(proof.ProofValue);
            var derivedProof = JsonLdProcessor.Compact(new BbsBlsSignatureProof2020(), Constants.SECURITY_CONTEXT_V2_URL, processorOptions);

            var documentStatements = BbsBlsSignature2020Suite.CreateVerifyDocumentData(document, processorOptions);
            var proofStatements    = BbsBlsSignature2020Suite.CreateVerifyProofData(proof, processorOptions);

            var transformedInputDocumentStatements = documentStatements.Select(TransformBlankNodeToId).ToArray();

            var compactInputDocument = Helpers.FromRdf(transformedInputDocumentStatements);

            var revealDocument           = JsonLdProcessor.Frame(compactInputDocument, options.ProofRequest, processorOptions);
            var revealDocumentStatements = BbsBlsSignature2020Suite.CreateVerifyDocumentData(revealDocument, processorOptions);

            var numberOfProofStatements = proofStatements.Count();

            var proofRevealIndicies    = EnumerableFromInt(numberOfProofStatements).ToArray();
            var documentRevealIndicies = revealDocumentStatements.Select(x => Array.IndexOf(transformedInputDocumentStatements, x) + numberOfProofStatements).ToArray();

            if (documentRevealIndicies.Count() != revealDocumentStatements.Count())
            {
                throw new Exception("Some statements in the reveal document not found in original proof");
            }

            var revealIndicies = proofRevealIndicies.Concat(documentRevealIndicies);

            derivedProof["nonce"] = options.Nonce ?? Guid.NewGuid().ToString();

            //Combine all the input statements that
            //were originally signed to generate the proof
            var allInputStatements = proofStatements.Concat(documentStatements);

            var verificationMethod = BbsBlsSignature2020Suite.GetVerificationMethod(proofs.First(), processorOptions);

            var outputProof = BbsProvider.CreateProof(new CreateProofRequest(
                                                          publicKey: verificationMethod.ToBlsKeyPair().GeyBbsKeyPair((uint)allInputStatements.Count()),
                                                          messages: GetProofMessages(allInputStatements.ToArray(), revealIndicies).ToArray(),
                                                          signature: signature,
                                                          blindingFactor: null,
                                                          nonce: derivedProof["nonce"].ToString()));

            // Set the proof value on the derived proof
            derivedProof["proofValue"] = Convert.ToBase64String(outputProof);

            // Set the relevant proof elements on the derived proof from the input proof
            derivedProof["verificationMethod"] = proof["verificationMethod"];
            derivedProof["proofPurpose"]       = proof["proofPurpose"];
            derivedProof["created"]            = proof["created"];

            revealDocument["proof"] = derivedProof;

            return(revealDocument);
        }
        public bool VerifyProof(VerifyProofOptions options, JsonLdProcessorOptions processorOptions)
        {
            options.Proof["type"] = "https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignature2020";

            var documentStatements = BbsBlsSignature2020Suite.CreateVerifyDocumentData(options.Document, processorOptions);
            var proofStatements    = BbsBlsSignature2020Suite.CreateVerifyProofData(options.Proof, processorOptions);

            var transformedInputDocumentStatements = documentStatements.Select(TransformIdToBlankNode).ToArray();

            var statementsToVerify = proofStatements.Concat(transformedInputDocumentStatements);

            var verificationMethod = BbsBlsSignature2020Suite.GetVerificationMethod(options.Proof, processorOptions);

            var proofData = Convert.FromBase64String(options.Proof["proofValue"].ToString());
            var nonce     = options.Proof["nonce"].ToString();

            var verifyResult = BbsProvider.VerifyProof(new VerifyProofRequest(
                                                           publicKey: verificationMethod.ToBlsKeyPair().GeyBbsKeyPair((uint)statementsToVerify.Count()),
                                                           proof: proofData,
                                                           messages: GetIndexedMessages(statementsToVerify.ToArray()).ToArray(),
                                                           nonce: nonce));

            return(verifyResult == SignatureProofStatus.Success);
        }