const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.js');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../didcomm/src/modules/routing/repository/DidCommMediatorRoutingRecord.ts
var DidCommMediatorRoutingRecord = class DidCommMediatorRoutingRecord extends __credo_ts_core.BaseRecord {
	constructor(props) {
		super();
		this.type = DidCommMediatorRoutingRecord.type;
		this.allowCache = true;
		if (props) {
			this.id = props.id ?? __credo_ts_core.utils.uuid();
			this.createdAt = props.createdAt ?? /* @__PURE__ */ new Date();
			this.routingKeys = props.routingKeys || [];
		}
	}
	get routingKeysWithKeyId() {
		return this.routingKeys.map((routingKey) => {
			if (typeof routingKey === "string") {
				const publicJwk$1 = __credo_ts_core.Kms.PublicJwk.fromPublicKey({
					kty: "OKP",
					crv: "Ed25519",
					publicKey: __credo_ts_core.TypedArrayEncoder.fromBase58(routingKey)
				});
				publicJwk$1.keyId = publicJwk$1.legacyKeyId;
				return publicJwk$1;
			}
			const publicJwk = __credo_ts_core.Kms.PublicJwk.fromFingerprint(routingKey.routingKeyFingerprint);
			publicJwk.keyId = routingKey.kmsKeyId;
			if (!publicJwk.is(__credo_ts_core.Kms.Ed25519PublicJwk)) throw new __credo_ts_core.CredoError("Expected mediator routing record key to be of type Ed25519.");
			return publicJwk;
		});
	}
	getTags() {
		return {
			...this._tags,
			routingKeyFingerprints: this.routingKeys.map((routingKey) => typeof routingKey === "string" ? __credo_ts_core.Kms.PublicJwk.fromPublicKey({
				kty: "OKP",
				crv: "Ed25519",
				publicKey: __credo_ts_core.TypedArrayEncoder.fromBase58(routingKey)
			}).fingerprint : routingKey.routingKeyFingerprint)
		};
	}
};
DidCommMediatorRoutingRecord.type = "MediatorRoutingRecord";
DidCommMediatorRoutingRecord.allowCache = true;

//#endregion
exports.DidCommMediatorRoutingRecord = DidCommMediatorRoutingRecord;