github.com/hyperledger/aries-framework-go@v0.3.2/test/bbs/src/vc.js (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  exports.signAries = function signAries(privateKey, vc, verificationMethod) {
     8      return new Promise((resolve, reject) => {
     9          signVCAsync(privateKey, vc, verificationMethod, (err, vcSigned) => {
    10              if (err) {
    11                  reject(err);
    12                  return;
    13              }
    14  
    15              resolve(vcSigned);
    16          });
    17      });
    18  }
    19  
    20  exports.verifyAries = function verifyAries(publicKey, vc) {
    21      return new Promise((resolve, reject) => {
    22          verifyVCAsync(publicKey, vc, (err) => {
    23              if (err) {
    24                  reject(err);
    25                  return;
    26              }
    27  
    28              resolve();
    29          });
    30      });
    31  }
    32  
    33  exports.deriveProofAries = function deriveProofAries(publicKey, vc, revealDoc, nonce) {
    34      return new Promise((resolve, reject) => {
    35          deriveVCProofAsync(publicKey, vc, revealDoc, nonce, (err, vcWithDerivedProof) => {
    36              if (err) {
    37                  reject(err);
    38                  return;
    39              }
    40  
    41              resolve(vcWithDerivedProof);
    42          });
    43      });
    44  }
    45  
    46  exports.verifyProofAries = function verifyProofAries(publicKey, vc) {
    47      return new Promise((resolve, reject) => {
    48          verifyProofVCAsync(publicKey, vc, (err) => {
    49              if (err) {
    50                  reject(err);
    51                  return;
    52              }
    53  
    54              resolve();
    55          });
    56      });
    57  }