{"version":3,"file":"OpenBadgesOAuthRecord.mjs","names":[],"sources":["../../src/repository/OpenBadgesOAuthRecord.ts"],"sourcesContent":["import type { TagsBase } from '@credo-ts/core'\nimport { BaseRecord, utils } from '@credo-ts/core'\n\nexport type DefaultOpenBadgesOAuthTags = {\n  host: string\n  subject?: string\n  clientId?: string\n}\n\nexport type OpenBadgesOAuthRecordProps = {\n  id?: string\n  createdAt?: Date\n  updatedAt?: Date\n  host: string\n  subject?: string\n  clientRegistration?: unknown // encrypted in storage by upstream wallet if configured\n  tokens?: { accessToken?: string; refreshToken?: string; expiresAt?: number }\n  tags?: TagsBase\n}\n\nexport class OpenBadgesOAuthRecord\n  extends BaseRecord<DefaultOpenBadgesOAuthTags, TagsBase>\n  implements OpenBadgesOAuthRecordProps\n{\n  public host!: string\n  public subject?: string\n  public clientRegistration?: unknown\n  public tokens?: { accessToken?: string; refreshToken?: string; expiresAt?: number }\n\n  public static readonly type = 'OpenBadgesOAuthRecord'\n  public readonly type = OpenBadgesOAuthRecord.type\n\n  public constructor(props: OpenBadgesOAuthRecordProps) {\n    super()\n    this.id = props.id ?? utils.uuid()\n    this.createdAt = props.createdAt ?? new Date()\n    this.updatedAt = props.updatedAt ?? new Date()\n    this.host = props.host\n    this.subject = props.subject\n    this.clientRegistration = props.clientRegistration\n    this.tokens = props.tokens\n    this._tags = props.tags ?? {}\n  }\n\n  public getTags(): DefaultOpenBadgesOAuthTags {\n    const clientId = (this.clientRegistration as any)?.client_id\n    return { ...this._tags, host: this.host, subject: this.subject, clientId }\n  }\n}\n\n\n"],"mappings":";;;;;;;CAoBa,wBAAb,MAAa,8BACH,WAEV;EASE,AAAO,YAAY,OAAmC;AACpD,UAAO;QAHO,OAAO,sBAAsB;AAI3C,QAAK,KAAK,MAAM,MAAM,MAAM,MAAM;AAClC,QAAK,YAAY,MAAM,6BAAa,IAAI,MAAM;AAC9C,QAAK,YAAY,MAAM,6BAAa,IAAI,MAAM;AAC9C,QAAK,OAAO,MAAM;AAClB,QAAK,UAAU,MAAM;AACrB,QAAK,qBAAqB,MAAM;AAChC,QAAK,SAAS,MAAM;AACpB,QAAK,QAAQ,MAAM,QAAQ,EAAE;;EAG/B,AAAO,UAAsC;GAC3C,MAAM,WAAY,KAAK,oBAA4B;AACnD,UAAO;IAAE,GAAG,KAAK;IAAO,MAAM,KAAK;IAAM,SAAS,KAAK;IAAS;IAAU;;;uBAjBrD,OAAO"}