
      import { Temporal } from "@js-temporal/polyfill";
      import { URLPattern } from "urlpattern-polyfill";
      globalThis.addEventListener = () => {};
    
import { Create } from "../type-BSR-vRXo.js";
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
import { assert } from "../assert-MZs1qjMx.js";
import "../assert_instance_of-DHz7EHNU.js";
import { lookupObject } from "../lookup-q8DeFAjR.js";
import "../actor-By5NMImS.js";
import "../key-B057bXm0.js";
import { doesActorOwnKey, getKeyOwner } from "../owner-jwXilm3L.js";
import { mockDocumentLoader, test } from "../testing-Cqwzq9nj.js";
import "../std__assert-X-_kMxKM.js";
import { assertFalse } from "../assert_rejects-DiIiJbZn.js";
import "../assert_is_error-BPGph1Jx.js";
import "../assert_not_equals-f3m3epl3.js";
import "../assert_throws-BOO88avQ.js";
import { rsaPublicKey1, rsaPublicKey2 } from "../keys-Dz9o2VwW.js";

//#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
	};
	const owner = await getKeyOwner(new URL("https://example.com/users/handle#main-key"), options);
	assertEquals(owner, 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));
	const owner3 = await getKeyOwner(rsaPublicKey1, options);
	assertEquals(owner3, owner2);
	const noOwner = await getKeyOwner(new URL("https://example.com/key2"), options);
	assertEquals(noOwner, null);
	const noOwner2 = await getKeyOwner(new URL("https://example.com/object"), options);
	assertEquals(noOwner2, null);
});

//#endregion