import "@js-temporal/polyfill";
import "urlpattern-polyfill";
globalThis.addEventListener = () => {};
import { o as Create } from "../vocab-Bpio__8L.mjs";
import { t as lookupObject } from "../lookup-CYys-YDK.mjs";
import { a as mockDocumentLoader, t as test } from "../testing-D_x7wGM2.mjs";
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
import "../std__assert-2v7gYiZp.mjs";
import { n as assertFalse } from "../assert_rejects-CJC9ThS-.mjs";
import { t as assert } from "../assert-DikXweDx.mjs";
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-B4ula5wz.mjs";
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DjU66drk.mjs";
//#region src/sig/owner.test.ts
test("doesActorOwnKey()", async () => {
	const options = {
		documentLoader: mockDocumentLoader,
		contextLoader: mockDocumentLoader
	};
	const activity = new Create({ actor: new URL("https://example.com/person") });
	assert(await doesActorOwnKey(activity, rsaPublicKey1, options));
	assert(await doesActorOwnKey(activity, rsaPublicKey2, options));
	const activity2 = new Create({ actor: new URL("https://example.com/hong-gildong") });
	assertFalse(await doesActorOwnKey(activity2, rsaPublicKey1, options));
	assertFalse(await doesActorOwnKey(activity2, rsaPublicKey2, options));
});
test("getKeyOwner()", async () => {
	const options = {
		documentLoader: mockDocumentLoader,
		contextLoader: mockDocumentLoader
	};
	assertEquals(await getKeyOwner(new URL("https://example.com/users/handle#main-key"), options), await lookupObject("https://example.com/users/handle", options));
	const owner2 = await getKeyOwner(new URL("https://example.com/key"), options);
	assertEquals(owner2, await lookupObject("https://example.com/person", options));
	assertEquals(await getKeyOwner(rsaPublicKey1, options), owner2);
	assertEquals(await getKeyOwner(new URL("https://example.com/key2"), options), null);
	assertEquals(await getKeyOwner(new URL("https://example.com/object"), options), null);
});
//#endregion
export {};
