UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

1 lines • 1.8 kB
{"version":3,"file":"W3cCredentialsModuleConfig.mjs","names":[],"sources":["../../../src/modules/vc/W3cCredentialsModuleConfig.ts"],"sourcesContent":["import type { DocumentLoaderWithContext } from './data-integrity/libraries/documentLoader'\n\nimport { defaultDocumentLoader } from './data-integrity/libraries/documentLoader'\n\n/**\n * W3cCredentialsModuleConfigOptions defines the interface for the options of the W3cCredentialsModuleConfig class.\n * This can contain optional parameters that have default values in the config class itself.\n */\nexport interface W3cCredentialsModuleConfigOptions {\n /**\n * Document loader to use for resolving JSON-LD objects. Takes a {@link AgentContext} as parameter,\n * and must return a {@link DocumentLoader} function.\n *\n * @example\n * ```\n * const myDocumentLoader = (agentContext: AgentContext) => {\n * return async (url) => {\n * if (url !== 'https://example.org') throw new Error(\"I don't know how to load this document\")\n *\n * return {\n * contextUrl: null,\n * documentUrl: url,\n * document: null\n * }\n * }\n * }\n * ```\n *\n *\n * @default {@link defaultDocumentLoader}\n */\n documentLoader?: DocumentLoaderWithContext\n}\n\nexport class W3cCredentialsModuleConfig {\n private options: W3cCredentialsModuleConfigOptions\n\n public constructor(options?: W3cCredentialsModuleConfigOptions) {\n this.options = options ?? {}\n }\n\n /** See {@link W3cCredentialsModuleConfigOptions.documentLoader} */\n public get documentLoader() {\n return this.options.documentLoader ?? defaultDocumentLoader\n }\n}\n"],"mappings":";;;;;AAkCA,IAAa,6BAAb,MAAwC;CAGtC,AAAO,YAAY,SAA6C;AAC9D,OAAK,UAAU,WAAW,EAAE;;;CAI9B,IAAW,iBAAiB;AAC1B,SAAO,KAAK,QAAQ,kBAAkB"}