{"version":3,"file":"AgentConfig.mjs","names":[],"sources":["../../src/agent/AgentConfig.ts"],"sourcesContent":["import { DEFAULT_SKEW_TIME } from '../crypto/jose/jwt/JwtPayload'\nimport type { Logger } from '../logger'\nimport { ConsoleLogger, LogLevel } from '../logger'\nimport type { InitConfig } from '../types'\nimport type { AgentDependencies } from './AgentDependencies'\n\nexport class AgentConfig {\n  private initConfig: InitConfig\n  public logger: Logger\n  public readonly agentDependencies: AgentDependencies\n  #getTrustedIssuersForVerification?: InitConfig['getTrustedIssuersForVerification']\n\n  public constructor(initConfig: InitConfig, agentDependencies: AgentDependencies) {\n    this.initConfig = initConfig\n    this.logger = initConfig.logger ?? new ConsoleLogger(LogLevel.Off)\n    this.agentDependencies = agentDependencies\n\n    if (initConfig?.getTrustedIssuersForVerification) {\n      this.setTrustedIssuersForVerification(initConfig.getTrustedIssuersForVerification)\n    }\n  }\n\n  public get allowInsecureHttpUrls() {\n    return this.initConfig.allowInsecureHttpUrls ?? false\n  }\n\n  public get autoUpdateStorageOnStartup() {\n    return this.initConfig.autoUpdateStorageOnStartup ?? false\n  }\n\n  public get validitySkewSeconds() {\n    return this.initConfig.validitySkewSeconds ?? DEFAULT_SKEW_TIME\n  }\n\n  public get getTrustedIssuersForVerification() {\n    return this.#getTrustedIssuersForVerification\n  }\n\n  public setTrustedIssuersForVerification(fn: InitConfig['getTrustedIssuersForVerification']) {\n    this.#getTrustedIssuersForVerification = fn\n  }\n\n  public extend(config: Partial<InitConfig>): AgentConfig {\n    return new AgentConfig({ ...this.initConfig, logger: this.logger, ...config }, this.agentDependencies)\n  }\n\n  public toJSON() {\n    return {\n      ...this.initConfig,\n      logger: this.logger.logLevel,\n      agentDependencies: Boolean(this.agentDependencies),\n    }\n  }\n}\n"],"mappings":";;;;;;;;AAMA,IAAa,cAAb,MAAa,YAAY;CAMvB,YAAmB,YAAwB,mBAAsC;;EAC/E,KAAK,aAAa;EAClB,KAAK,SAAS,WAAW,UAAU,IAAI,cAAA,CAA0B;EACjE,KAAK,oBAAoB;EAEzB,IAAI,YAAY,kCACd,KAAK,iCAAiC,WAAW,gCAAgC;CAErF;CAEA,IAAW,wBAAwB;EACjC,OAAO,KAAK,WAAW,yBAAyB;CAClD;CAEA,IAAW,6BAA6B;EACtC,OAAO,KAAK,WAAW,8BAA8B;CACvD;CAEA,IAAW,sBAAsB;EAC/B,OAAO,KAAK,WAAW,uBAAA;CACzB;CAEA,IAAW,mCAAmC;EAC5C,OAAA,uBAAA,mCAAO,IAAA;CACT;CAEA,iCAAwC,IAAoD;EAC1F,uBAAA,mCAAA,MAAyC,EAAA;CAC3C;CAEA,OAAc,QAA0C;EACtD,OAAO,IAAI,YAAY;GAAE,GAAG,KAAK;GAAY,QAAQ,KAAK;GAAQ,GAAG;EAAO,GAAG,KAAK,iBAAiB;CACvG;CAEA,SAAgB;EACd,OAAO;GACL,GAAG,KAAK;GACR,QAAQ,KAAK,OAAO;GACpB,mBAAmB,QAAQ,KAAK,iBAAiB;EACnD;CACF;AACF"}