{"version":3,"file":"OpenBadgesModuleConfig.mjs","names":[],"sources":["../src/OpenBadgesModuleConfig.ts"],"sourcesContent":["import {\n  CRYPTOSUITE_ECDSA_SD_2023,\n  CRYPTOSUITE_EDDSA_RDFC_2022,\n  PROOF_TYPE_ED25519_2020,\n} from './cryptosuites'\n\n/**\n * Supported cryptosuites for JSON-LD proofs\n */\nexport type Cryptosuite =\n  | typeof CRYPTOSUITE_EDDSA_RDFC_2022 // 'eddsa-rdfc-2022' - Required for OBv3 cert\n  | typeof CRYPTOSUITE_ECDSA_SD_2023 // 'ecdsa-sd-2023' - Required for OBv3 cert\n  | typeof PROOF_TYPE_ED25519_2020 // 'Ed25519Signature2020' - Legacy\n\n/**\n * Supported DID methods\n */\nexport type DidMethod = 'did:web' | 'did:key' | 'did:jwk'\n\n/**\n * Selective disclosure configuration\n */\nexport interface SelectiveDisclosureConfig {\n  /** Enable selective disclosure support */\n  enabled: boolean\n  /** Default mandatory pointers (JSON Pointers that are always disclosed) */\n  mandatoryPointers?: string[]\n}\n\n/**\n * Status list configuration\n */\nexport interface StatusListConfig {\n  /** Enable status list support for revocation/suspension */\n  enabled: boolean\n  /** Default purpose: 'revocation' or 'suspension' */\n  defaultPurpose?: 'revocation' | 'suspension'\n  /** Status list credential validity period in seconds */\n  validityPeriod?: number\n}\n\nexport type OpenBadgesModuleConfigOptions = {\n  /**\n   * DID method to use for issuer identifiers\n   * @default 'did:web'\n   */\n  didMethod?: DidMethod\n\n  /**\n   * Proof format: 'jsonld' (Data Integrity / Linked Data Proof) or 'jwt' (VC-JWT)\n   * @default 'jsonld'\n   */\n  proofFormat?: 'jsonld' | 'jwt'\n\n  /**\n   * Cryptosuite to use for JSON-LD proofs\n   * - 'eddsa-rdfc-2022': Ed25519 with RDFC canonicalization (recommended, required for cert)\n   * - 'ecdsa-sd-2023': ECDSA P-256 with selective disclosure (required for cert)\n   * - 'Ed25519Signature2020': Legacy Ed25519 suite\n   * @default 'eddsa-rdfc-2022'\n   */\n  cryptosuite?: Cryptosuite\n\n  /**\n   * Selective disclosure configuration\n   * Only applicable when cryptosuite is 'ecdsa-sd-2023'\n   */\n  selectiveDisclosure?: SelectiveDisclosureConfig\n\n  /**\n   * Status list configuration for credential revocation/suspension\n   */\n  statusList?: StatusListConfig\n\n  /**\n   * @deprecated Use proofFormat instead\n   */\n  proofType?: 'jsonld' | 'jwt'\n\n  /**\n   * @deprecated No longer used\n   */\n  allowJwtProofs?: boolean\n\n  /**\n   * Cache JSON-LD contexts locally\n   * @default true\n   */\n  cacheContexts?: boolean\n}\n\nexport class OpenBadgesModuleConfig {\n  public readonly didMethod: DidMethod\n  public readonly proofFormat: 'jsonld' | 'jwt'\n  public readonly cryptosuite: Cryptosuite\n  public readonly selectiveDisclosure: SelectiveDisclosureConfig\n  public readonly statusList: StatusListConfig\n  public readonly cacheContexts: boolean\n\n  /** @deprecated Use proofFormat instead */\n  public readonly proofType: 'jsonld' | 'jwt'\n  /** @deprecated No longer used */\n  public readonly allowJwtProofs: boolean\n\n  public constructor(options: OpenBadgesModuleConfigOptions = {}) {\n    this.didMethod = options.didMethod ?? 'did:web'\n    this.proofFormat = options.proofFormat ?? options.proofType ?? 'jsonld'\n    this.proofType = this.proofFormat // Backward compat\n    this.cryptosuite = options.cryptosuite ?? CRYPTOSUITE_EDDSA_RDFC_2022\n\n    this.selectiveDisclosure = options.selectiveDisclosure ?? {\n      enabled: false,\n      mandatoryPointers: [\n        '/issuer',\n        '/validFrom',\n        '/credentialSubject/id',\n        '/credentialSubject/achievement/id',\n        '/credentialSubject/achievement/name',\n      ],\n    }\n\n    this.statusList = options.statusList ?? {\n      enabled: false,\n      defaultPurpose: 'revocation',\n      validityPeriod: 86400, // 24 hours\n    }\n\n    this.cacheContexts = options.cacheContexts ?? true\n    this.allowJwtProofs = options.allowJwtProofs ?? false\n  }\n\n  /**\n   * Check if selective disclosure is supported and enabled\n   */\n  public get supportsSelectiveDisclosure(): boolean {\n    return this.selectiveDisclosure.enabled && this.cryptosuite === CRYPTOSUITE_ECDSA_SD_2023\n  }\n\n  /**\n   * Check if using a Data Integrity cryptosuite\n   */\n  public get isDataIntegritySuite(): boolean {\n    return (\n      this.cryptosuite === CRYPTOSUITE_EDDSA_RDFC_2022 ||\n      this.cryptosuite === CRYPTOSUITE_ECDSA_SD_2023\n    )\n  }\n\n  /**\n   * Check if using JWT format\n   */\n  public get isJwtFormat(): boolean {\n    return this.proofFormat === 'jwt'\n  }\n}\n"],"mappings":";;;;AA2FA,IAAa,yBAAb,MAAoC;CAalC,AAAO,YAAY,UAAyC,EAAE,EAAE;AAC9D,OAAK,YAAY,QAAQ,aAAa;AACtC,OAAK,cAAc,QAAQ,eAAe,QAAQ,aAAa;AAC/D,OAAK,YAAY,KAAK;AACtB,OAAK,cAAc,QAAQ,eAAe;AAE1C,OAAK,sBAAsB,QAAQ,uBAAuB;GACxD,SAAS;GACT,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACD;GACF;AAED,OAAK,aAAa,QAAQ,cAAc;GACtC,SAAS;GACT,gBAAgB;GAChB,gBAAgB;GACjB;AAED,OAAK,gBAAgB,QAAQ,iBAAiB;AAC9C,OAAK,iBAAiB,QAAQ,kBAAkB;;;;;CAMlD,IAAW,8BAAuC;AAChD,SAAO,KAAK,oBAAoB,WAAW,KAAK,gBAAgB;;;;;CAMlE,IAAW,uBAAgC;AACzC,SACE,KAAK,gBAAgB,+BACrB,KAAK,gBAAgB;;;;;CAOzB,IAAW,cAAuB;AAChC,SAAO,KAAK,gBAAgB"}