{"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;;OACjC,mBAAmB,CAAC,MAAM;OAK1B,gBAAgB;OAMhB,uBAAuB;;CAEvC,MAAa,QAAQ,eAA6B,KAA2C;EAC3F,MAAM,sBAAsB,EAAE;AAE9B,MAAI;AAGF,UAAO;IACL,aAHkB,OAAO,QAAQ,IAAI,CAAC;IAItC;IACA,uBAAuB,EAAE,aAAa,2BAA2B;IAClE;WACM,OAAO;AACd,UAAO;IACL,aAAa;IACb;IACA,uBAAuB;KACrB,OAAO;KACP,SAAS,0CAA0C,IAAI,KAAK;KAC7D;IACF"}