{"version":3,"file":"verifiable-credential.cjs","sources":["../../../src/vc/verifiable-credential.js"],"sourcesContent":["import { expandJSONLD } from './helpers';\nimport { issueCredential, verifyCredential } from './credentials';\nimport { DEFAULT_CONTEXT, DEFAULT_TYPE } from './constants';\n\nimport { validateCredentialSchema } from './schema';\n\nimport {\n  ensureObjectWithId,\n  isObject,\n  ensureString,\n  ensureURI,\n  ensureValidDatetime,\n  getUniqueElementsFromArray,\n} from '../utils';\n\n/**\n * @typedef {object} VerifiableCredentialVerificationResult The credential verification result\n * @property {Boolean} verified Is this credential verified or not\n * @property {array} results Verification results\n * @property {any} [error] Optional error\n */\n\n/**\n * Representation of a Verifiable Credential.\n */\nclass VerifiableCredential {\n  /**\n   * Create a new Verifiable Credential instance.\n   * @param {string} id - id of the credential\n   */\n  constructor(id) {\n    if (id) {\n      this.setId(id);\n    }\n\n    this.context = [DEFAULT_CONTEXT];\n    this.type = [DEFAULT_TYPE];\n    this.credentialSubject = [];\n    this.setIssuanceDate(new Date().toISOString());\n  }\n\n  /**\n   * Sets the credential's ID\n   * @param {string} id - Signed credential's ID\n   * @returns {VerifiableCredential}\n   */\n  setId(id) {\n    this.constructor.verifyID(id);\n    this.id = id;\n    return this;\n  }\n\n  /**\n   * Fail if the given verifiable credential id isn't a valid URI.\n   * @param {*} id\n   */\n  static verifyID(id) {\n    ensureURI(id);\n  }\n\n  /**\n   * Sets the credential's issuer DID\n   * @param {string} issuer - the issuer's did\n   * @returns {VerifiableCredential}\n   */\n  setIssuer(issuer) {\n    this.issuer = issuer;\n    return this;\n  }\n\n  /**\n   * Sets the credential's proof\n   * @param {object} proof - Signed credential proof\n   * @returns {VerifiableCredential}\n   */\n  setProof(proof) {\n    this.proof = proof;\n    return this;\n  }\n\n  /**\n   * Sets the `credentialSchema` field of the credential with the given id and type as specified in the RFC.\n   * @param {string} id - schema ID URI\n   * @param {string} type - type of the credential schema\n   */\n  setSchema(id, type) {\n    this.constructor.verifyID(id);\n    this.credentialSchema = {\n      id,\n      type,\n    };\n  }\n\n  /**\n   * Check that the credential is compliant with given JSON schema, meaning `credentialSubject` has the\n   * structure specified by the given JSON schema. Use `validateCredentialSchema` but exclude subject's id.\n   * Allows issuer to validate schema before adding it.\n   * @param {object} schema - The schema to validate with\n   * @returns {Promise<Boolean>}\n   */\n  async validateSchema(schema) {\n    if (!this.credentialSubject) {\n      throw new Error('No credential subject defined');\n    }\n\n    const expanded = await expandJSONLD(this.toJSON());\n    return validateCredentialSchema(expanded, schema, this.context);\n  }\n\n  /**\n   * Sets the context to the given value, overrding all others\n   * @param {string|object} context - Context to assign\n   * @returns {VerifiableCredential}\n   */\n  setContext(context) {\n    if (!isObject(context) && !Array.isArray(context)) {\n      this.constructor.verifyID(context);\n    }\n    this.context = context;\n    return this;\n  }\n\n  /**\n   * Add a context to this Credential's context array. Duplicates are omitted.\n   * @param {string|object} context - Context to add to the credential context array\n   * @returns {VerifiableCredential}\n   */\n  addContext(context) {\n    if (!isObject(context)) {\n      this.constructor.verifyID(context);\n    }\n    this.context = getUniqueElementsFromArray(\n      [...this.context, context],\n      JSON.stringify,\n    );\n    return this;\n  }\n\n  /**\n   * Add a type to this Credential's type array. Duplicates are omitted.\n   * @param {string} type - Type to add to the credential type array\n   * @returns {VerifiableCredential}\n   */\n  addType(type) {\n    ensureString(type);\n    this.type = [...new Set([...this.type, type])];\n    return this;\n  }\n\n  /**\n   * Add a subject to this Credential. Duplicates are omitted.\n   * @param {object} subject -  Subject of the credential\n   * @returns {VerifiableCredential}\n   */\n  addSubject(subject) {\n    if (!this.credentialSubject || this.credentialSubject.length === 0) {\n      this.credentialSubject = [subject];\n    }\n\n    const subjects = this.credentialSubject.length\n      ? this.credentialSubject\n      : [this.credentialSubject];\n    this.credentialSubject = getUniqueElementsFromArray(\n      [...subjects, subject],\n      JSON.stringify,\n    );\n    return this;\n  }\n\n  /**\n   * Set the subject for this Credential\n   * @param {object|array} subject - Subject of the credential as object or array\n   * @returns {VerifiableCredential}\n   */\n  setSubject(subject) {\n    if (!isObject(subject) && !Array.isArray(subject)) {\n      throw new Error('credentialSubject must be either an object or array');\n    }\n    this.credentialSubject = subject;\n    return this;\n  }\n\n  /**\n   * Set a status for this Credential\n   * @param {object} status -  Status of the credential\n   * @returns {VerifiableCredential}\n   */\n  setStatus(status) {\n    ensureObjectWithId(status, 'credentialStatus');\n    if (!status.type) {\n      throw new Error('\"credentialStatus\" must include a type.');\n    }\n    this.status = status;\n    return this;\n  }\n\n  /**\n   * Set a issuance date for this Credential\n   * @param {string} issuanceDate -  issuanceDate of the credential\n   * @returns {VerifiableCredential}\n   */\n  setIssuanceDate(issuanceDate) {\n    ensureValidDatetime(issuanceDate);\n    this.issuanceDate = issuanceDate;\n    return this;\n  }\n\n  /**\n   * Set a expiration date for this Credential\n   * @param {object} expirationDate -  expirationDate of the credential\n   * @returns {VerifiableCredential}\n   */\n  setExpirationDate(expirationDate) {\n    ensureValidDatetime(expirationDate);\n    this.expirationDate = expirationDate;\n    return this;\n  }\n\n  /**\n   * Define the JSON representation of a Verifiable Credential.\n   * @returns {object}\n   */\n  toJSON() {\n    const { context, status, ...rest } = this;\n    const credJson = {\n      '@context': context,\n    };\n    if (status) {\n      credJson.credentialStatus = status;\n    }\n    return {\n      ...credJson,\n      ...rest,\n    };\n  }\n\n  /**\n   * Sign a Verifiable Credential using the provided keyDoc\n   * @param {object} keyDoc - key document containing `id`, `controller`, `type`, `privateKeyBase58` and `publicKeyBase58`\n   * @param {Boolean} [compactProof] - Whether to compact the JSON-LD or not.\n   * @param {object} [issuerObject] - Optional issuer object to assign\n   * @param {Boolean} [addSuiteContext] - Toggles the default\n   *   behavior of each signature suite enforcing the presence of its own\n   *   `@context` (if it is not present, it's added to the context list).\n   * @param {(jsonld|jwt|proofValue)} [type] - Optional format/type of the credential (JSON-LD, JWT, proofValue)\n   * @returns {Promise<VerifiableCredential>}\n   */\n  async sign(\n    keyDoc,\n    compactProof = true,\n    issuerObject = null,\n    addSuiteContext = true,\n    documentLoader = null,\n    type = null,\n  ) {\n    const signedVC = await issueCredential(\n      keyDoc,\n      this.toJSON(),\n      compactProof,\n      documentLoader,\n      null,\n      void 0,\n      issuerObject,\n      addSuiteContext,\n      type,\n    );\n    this.setProof(signedVC.proof);\n    this.issuer = signedVC.issuer;\n    this.context = signedVC['@context'];\n    return this;\n  }\n\n  /**\n   * Verify a Verifiable Credential\n   * @param {object} [params] Verify parameters (TODO: add type info for this object)\n   * @returns {Promise<VerifiableCredentialVerificationResult>}\n   */\n  async verify({\n    resolver = null,\n    compactProof = true,\n    skipRevocationCheck = false,\n    skipSchemaCheck = false,\n    suite = [],\n  } = {}) {\n    if (!this.proof) {\n      throw new Error('The current Verifiable Credential has no proof.');\n    }\n\n    return verifyCredential(this.toJSON(), {\n      resolver,\n      compactProof,\n      skipRevocationCheck,\n      skipSchemaCheck,\n      suite,\n    });\n  }\n\n  /**\n   * Sets this credential's properties based on a JSON object\n   * @param {object} json - VC JSON\n   * @returns {VerifiableCredential}\n   */\n  setFromJSON(json) {\n    const subject = json.credentialSubject || json.subject;\n    if (subject) {\n      const subjects = subject.length ? subject : [subject];\n      subjects.forEach((value) => {\n        this.addSubject(value);\n      });\n    }\n\n    if (json.proof) {\n      this.setProof(json.proof);\n    }\n\n    if (json.issuer) {\n      this.setIssuer(json.issuer);\n    }\n\n    const status = json.credentialStatus || json.status;\n    if (status) {\n      this.setStatus(status);\n    }\n\n    if (json.issuanceDate) {\n      this.setIssuanceDate(json.issuanceDate);\n    }\n\n    if (json.expirationDate) {\n      this.setExpirationDate(json.expirationDate);\n    }\n\n    Object.assign(this, json);\n    return this;\n  }\n\n  /**\n   * Creates a new VerifiableCredential instance from a JSON object\n   * @param {object} json - VC JSON\n   * @returns {VerifiableCredential}\n   */\n  static fromJSON(json) {\n    const cert = new this(json.id);\n    const contexts = json['@context'];\n    if (contexts) {\n      cert.setContext(contexts);\n    } else {\n      throw new Error(\n        'No context found in JSON object, verifiable credentials must have a @context field.',\n      );\n    }\n\n    const types = json.type;\n    if (types) {\n      cert.type = [];\n      if (types.length !== undefined) {\n        types.forEach((typeVal) => {\n          cert.addType(typeVal);\n        });\n      } else {\n        cert.addType(types);\n      }\n    } else {\n      throw new Error(\n        'No type found in JSON object, verifiable credentials must have a type field.',\n      );\n    }\n\n    return cert.setFromJSON(json);\n  }\n}\n\nexport default VerifiableCredential;\n"],"names":["DEFAULT_CONTEXT","DEFAULT_TYPE","ensureURI","expandJSONLD","validateCredentialSchema","isObject","getUniqueElementsFromArray","ensureString","ensureObjectWithId","ensureValidDatetime","issueCredential","verifyCredential"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM,oBAAoB,CAAC;AAC3B;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,EAAE,EAAE;AAClB,IAAI,IAAI,EAAE,EAAE;AACZ,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;AACpB,IAAI;;AAEJ,IAAI,IAAI,CAAC,OAAO,GAAG,CAACA,4BAAe,CAAC;AACpC,IAAI,IAAI,CAAC,IAAI,GAAG,CAACC,yBAAY,CAAC;AAC9B,IAAI,IAAI,CAAC,iBAAiB,GAAG,EAAE;AAC/B,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClD,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE,KAAK,CAAC,EAAE,EAAE;AACZ,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjC,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE;AAChB,IAAI,OAAO,IAAI;AACf,EAAE;;AAEF;AACA;AACA;AACA;AACA,EAAE,OAAO,QAAQ,CAAC,EAA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