{"version":3,"file":"JwkDidResolver.mjs","names":[],"sources":["../../../../../src/modules/dids/methods/jwk/JwkDidResolver.ts"],"sourcesContent":["import type { AgentContext } from '../../../../agent'\nimport type { DidResolver } from '../../domain/DidResolver'\nimport type { DidResolutionResult } from '../../types'\n\nimport { DidJwk } from './DidJwk'\n\nexport class JwkDidResolver implements DidResolver {\n  public readonly supportedMethods = ['jwk']\n\n  /**\n   * No remote resolving done, did document is dynamically constructed. To not pollute the cache we don't allow caching\n   */\n  public readonly allowsCaching = false\n\n  /**\n   * Easier to calculate for resolving than serving the local did document. Record also doesn't\n   * have a did document\n   */\n  public readonly allowsLocalDidRecord = false\n\n  public async resolve(_agentContext: AgentContext, did: string): Promise<DidResolutionResult> {\n    const didDocumentMetadata = {}\n\n    try {\n      const didDocument = DidJwk.fromDid(did).didDocument\n\n      return {\n        didDocument,\n        didDocumentMetadata,\n        didResolutionMetadata: { contentType: 'application/did+ld+json' },\n      }\n    } catch (error) {\n      return {\n        didDocument: null,\n        didDocumentMetadata,\n        didResolutionMetadata: {\n          error: 'notFound',\n          message: `resolver_error: Unable to resolve did '${did}': ${error}`,\n        },\n      }\n    }\n  }\n}\n"],"mappings":";;AAMA,IAAa,iBAAb,MAAmD;;EACjD,KAAgB,mBAAmB,CAAC,KAAK;EAKzC,KAAgB,gBAAgB;EAMhC,KAAgB,uBAAuB;;CAEvC,MAAa,QAAQ,eAA6B,KAA2C;EAC3F,MAAM,sBAAsB,CAAC;EAE7B,IAAI;GAGF,OAAO;IACL,aAHkB,OAAO,QAAQ,GAAG,CAAC,CAAC;IAItC;IACA,uBAAuB,EAAE,aAAa,0BAA0B;GAClE;EACF,SAAS,OAAO;GACd,OAAO;IACL,aAAa;IACb;IACA,uBAAuB;KACrB,OAAO;KACP,SAAS,0CAA0C,IAAI,KAAK;IAC9D;GACF;EACF;CACF;AACF"}