
      import { Temporal } from "@js-temporal/polyfill";
      import { URLPattern } from "urlpattern-polyfill";
      globalThis.addEventListener = () => {};
    
import { exportMultibaseKey, exportSpki, importMultibaseKey, importPem, importPkcs1, importSpki } from "../type-BSR-vRXo.js";
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
import "../assert-MZs1qjMx.js";
import "../assert_instance_of-DHz7EHNU.js";
import "../lookup-q8DeFAjR.js";
import "../actor-By5NMImS.js";
import { exportJwk, importJwk } from "../key-B057bXm0.js";
import { test } from "../testing-Cqwzq9nj.js";
import "../std__assert-X-_kMxKM.js";
import "../assert_rejects-DiIiJbZn.js";
import "../assert_is_error-BPGph1Jx.js";
import "../assert_not_equals-f3m3epl3.js";
import "../assert_throws-BOO88avQ.js";

//#region src/runtime/key.test.ts
const rsaSpki = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxsRuvCkgJtflBTl4OVsm\nnt/J1mQfZasfJtN33dcZ3d1lJroxmgmMu69zjGEAwkNbMQaWNLqC4eogkJaeJ4RR\n5MHYXkL9nNilVoTkjX5BVit3puzs7XJ7WQnKQgQMI+ezn24GHsZ/v1JIo77lerX5\nk4HNwTNVt+yaZVQWaOMR3+6FwziQR6kd0VuG9/a9dgAnz2cEoORRC1i4W7IZaB1s\nZnh1WbHbevlGd72HSXll5rocPIHn8gq6xpBgpHwRphlRsgn4KHaJ6brXDIJjrnQh\nIe/YUBOGj/ImSEXhRwlFerKsoAVnZ0Hwbfa46qk44TAt8CyoPMWmpK6pt0ng4pQ2\nuwIDAQAB\n-----END PUBLIC KEY-----\n";
const rsaPkcs1 = "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAxsRuvCkgJtflBTl4OVsmnt/J1mQfZasfJtN33dcZ3d1lJroxmgmM\nu69zjGEAwkNbMQaWNLqC4eogkJaeJ4RR5MHYXkL9nNilVoTkjX5BVit3puzs7XJ7\nWQnKQgQMI+ezn24GHsZ/v1JIo77lerX5k4HNwTNVt+yaZVQWaOMR3+6FwziQR6kd\n0VuG9/a9dgAnz2cEoORRC1i4W7IZaB1sZnh1WbHbevlGd72HSXll5rocPIHn8gq6\nxpBgpHwRphlRsgn4KHaJ6brXDIJjrnQhIe/YUBOGj/ImSEXhRwlFerKsoAVnZ0Hw\nbfa46qk44TAt8CyoPMWmpK6pt0ng4pQ2uwIDAQAB\n-----END RSA PUBLIC KEY-----\n";
const rsaJwk = {
	alg: "RS256",
	e: "AQAB",
	ext: true,
	key_ops: ["verify"],
	kty: "RSA",
	n: "xsRuvCkgJtflBTl4OVsmnt_J1mQfZasfJtN33dcZ3d1lJroxmgmMu69zjGEAwkNbMQaWNLqC4eogkJaeJ4RR5MHYXkL9nNilVoTkjX5BVit3puzs7XJ7WQnKQgQMI-ezn24GHsZ_v1JIo77lerX5k4HNwTNVt-yaZVQWaOMR3-6FwziQR6kd0VuG9_a9dgAnz2cEoORRC1i4W7IZaB1sZnh1WbHbevlGd72HSXll5rocPIHn8gq6xpBgpHwRphlRsgn4KHaJ6brXDIJjrnQhIe_YUBOGj_ImSEXhRwlFerKsoAVnZ0Hwbfa46qk44TAt8CyoPMWmpK6pt0ng4pQ2uw"
};
const rsaMultibase = "z4MXj1wBzi9jUstyPqYMn6Gum79JtbKFiHTibtPRoPeufjdimA24Kg8Q5N7E2eMpgVUtD61kUvmy4FaT5D5G8XU3ktxeduwEw5FHTtiLCzaruadf6rit1AUPL34UtcPuHh6GxBzTxgFKMMuzcHiUzG9wvbxn7toS4H2gbmUn1r91836ET2EVgmSdzju614Wu67ukyBGivcboncdfxPSR5JXwURBaL8K2P6yhKn3NyprFV8s6QpN4zgQMAD3Q6fjAsEvGNwXaQTZmEN2yd1NQ7uBE3RJ2XywZnehmfLQTEqD7Ad5XM3qfLLd9CtdzJGBkRfunHhkH1kz8dHL7hXwtk5EMXktY4QF5gZ1uisUV5mpPjEgqz7uDz";
const ed25519Pem = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAvrabdlLgVI5jWl7GpF+fLFJVF4ccI8D7h+v5ulBCYwo=\n-----END PUBLIC KEY-----\n";
const ed25519Jwk = {
	alg: "Ed25519",
	kty: "OKP",
	crv: "Ed25519",
	x: "vrabdlLgVI5jWl7GpF-fLFJVF4ccI8D7h-v5ulBCYwo",
	key_ops: ["verify"],
	ext: true
};
const ed25519Multibase = "z6MksHj1MJnidCtDiyYW9ugNFftoX9fLK4bornTxmMZ6X7vq";
test("importSpki()", async () => {
	const rsaKey = await importSpki(rsaSpki);
	assertEquals(await exportJwk(rsaKey), rsaJwk);
	const ed25519Key = await importSpki(ed25519Pem);
	assertEquals(await exportJwk(ed25519Key), ed25519Jwk);
});
test("exportSpki()", async () => {
	const rsaKey = await importJwk(rsaJwk, "public");
	const rsaSpki$1 = await exportSpki(rsaKey);
	assertEquals(rsaSpki$1, rsaSpki$1);
	const ed25519Key = await importJwk(ed25519Jwk, "public");
	const ed25519Spki = await exportSpki(ed25519Key);
	assertEquals(ed25519Spki, ed25519Pem);
});
test("importPkcs1()", async () => {
	const rsaKey = await importPkcs1(rsaPkcs1);
	assertEquals(await exportJwk(rsaKey), rsaJwk);
});
test("importPem()", async () => {
	const rsaPkcs1Key = await importPem(rsaPkcs1);
	assertEquals(await exportJwk(rsaPkcs1Key), rsaJwk);
	const rsaSpkiKey = await importPem(rsaSpki);
	assertEquals(await exportJwk(rsaSpkiKey), rsaJwk);
	const ed25519Key = await importPem(ed25519Pem);
	assertEquals(await exportJwk(ed25519Key), ed25519Jwk);
});
test("importMultibase()", async () => {
	const rsaKey = await importMultibaseKey(rsaMultibase);
	assertEquals(await exportJwk(rsaKey), rsaJwk);
	const ed25519Key = await importMultibaseKey(ed25519Multibase);
	assertEquals(await exportJwk(ed25519Key), ed25519Jwk);
});
test("exportMultibaseKey()", async () => {
	const rsaKey = await importJwk(rsaJwk, "public");
	const rsaMb = await exportMultibaseKey(rsaKey);
	assertEquals(rsaMb, rsaMultibase);
	const ed25519Key = await importJwk(ed25519Jwk, "public");
	const ed25519Mb = await exportMultibaseKey(ed25519Key);
	assertEquals(ed25519Mb, ed25519Multibase);
	const rsaKey2 = await importJwk({
		alg: "RS256",
		ext: true,
		key_ops: ["verify"],
		e: "AQAB",
		kty: "RSA",
		n: "sbX82NTV6IylxCh7MfV4hlyvaniCajuP97GyOqSvTmoEdBOflFvZ06kR_9D6ctt45Fk6hskfnag2GG69NALVH2o4RCR6tQiLRpKcMRtDYE_thEmfBvDzm_VVkOIYfxu-Ipuo9J_S5XDNDjczx2v-3oDh5-CIHkU46hvFeCvpUS-L8TJSbgX0kjVk_m4eIb9wh63rtmD6Uz_KBtCo5mmR4TEtcLZKYdqMp3wCjN-TlgHiz_4oVXWbHUefCEe8rFnX1iQnpDHU49_SaXQoud1jCaexFn25n-Aa8f8bc5Vm-5SeRwidHa6ErvEhTvf1dz6GoNPp2iRvm-wJ1gxwWJEYPQ"
	}, "public");
	const rsaMb2 = await exportMultibaseKey(rsaKey2);
	assertEquals(rsaMb2, "z4MXj1wBzi9jUstyPMS4jQqB6KdJaiatPkAtVtGc6bQEQEEsKTic4G7Rou3iBf9vPmT5dbkm9qsZsuVNjq8HCuW1w24nhBFGkRE4cd2Uf2tfrB3N7h4mnyPp1BF3ZttHTYv3DLUPi1zMdkULiow3M1GfXkoC6DoxDUm1jmN6GBj22SjVsr6dxezRVQc7aj9TxE7JLbMH1wh5X3kA58H3DFW8rnYMakFGbca5CB2Jf6CnGQZmL7o5uJAdTwXfy2iiiyPxXEGerMhHwhjTA1mKYobyk2CpeEcmvynADfNZ5MBvcCS7m3XkFCMNUYBS9NQ3fze6vMSUPsNa6GVYmKx2x6JrdEjCk3qRMMmyjnjCMfR4pXbRMZa3i");
	const ed25519Key2 = await importJwk({
		alg: "Ed25519",
		crv: "Ed25519",
		ext: true,
		key_ops: ["verify"],
		kty: "OKP",
		x: "Lm_M42cB3HkUiODQsXRcweM6TByfzEHGO9ND274JcOY"
	}, "public");
	const ed25519Mb2 = await exportMultibaseKey(ed25519Key2);
	assertEquals(ed25519Mb2, "z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK");
});

//#endregion