import "@js-temporal/polyfill";
import "urlpattern-polyfill";
globalThis.addEventListener = () => {};
import { F as importPkcs1, I as importSpki, M as exportSpki, N as importMultibaseKey, P as importPem, j as exportMultibaseKey } from "../vocab-C5EUmVTj.mjs";
import { t as test } from "../testing-BQeTO4ss.mjs";
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
import "../std__assert-2v7gYiZp.mjs";
import { i as importJwk, t as exportJwk } from "../key-CvS3OKm_.mjs";
//#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 () => {
	assertEquals(await exportJwk(await importSpki(rsaSpki)), rsaJwk);
	assertEquals(await exportJwk(await importSpki(ed25519Pem)), ed25519Jwk);
});
test("exportSpki()", async () => {
	const rsaSpki = await exportSpki(await importJwk(rsaJwk, "public"));
	assertEquals(rsaSpki, rsaSpki);
	assertEquals(await exportSpki(await importJwk(ed25519Jwk, "public")), ed25519Pem);
});
test("importPkcs1()", async () => {
	assertEquals(await exportJwk(await importPkcs1(rsaPkcs1)), rsaJwk);
});
test("importPem()", async () => {
	assertEquals(await exportJwk(await importPem(rsaPkcs1)), rsaJwk);
	assertEquals(await exportJwk(await importPem(rsaSpki)), rsaJwk);
	assertEquals(await exportJwk(await importPem(ed25519Pem)), ed25519Jwk);
});
test("importMultibase()", async () => {
	assertEquals(await exportJwk(await importMultibaseKey(rsaMultibase)), rsaJwk);
	assertEquals(await exportJwk(await importMultibaseKey(ed25519Multibase)), ed25519Jwk);
});
test("exportMultibaseKey()", async () => {
	assertEquals(await exportMultibaseKey(await importJwk(rsaJwk, "public")), rsaMultibase);
	assertEquals(await exportMultibaseKey(await importJwk(ed25519Jwk, "public")), ed25519Multibase);
	assertEquals(await exportMultibaseKey(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")), "z4MXj1wBzi9jUstyPMS4jQqB6KdJaiatPkAtVtGc6bQEQEEsKTic4G7Rou3iBf9vPmT5dbkm9qsZsuVNjq8HCuW1w24nhBFGkRE4cd2Uf2tfrB3N7h4mnyPp1BF3ZttHTYv3DLUPi1zMdkULiow3M1GfXkoC6DoxDUm1jmN6GBj22SjVsr6dxezRVQc7aj9TxE7JLbMH1wh5X3kA58H3DFW8rnYMakFGbca5CB2Jf6CnGQZmL7o5uJAdTwXfy2iiiyPxXEGerMhHwhjTA1mKYobyk2CpeEcmvynADfNZ5MBvcCS7m3XkFCMNUYBS9NQ3fze6vMSUPsNa6GVYmKx2x6JrdEjCk3qRMMmyjnjCMfR4pXbRMZa3i");
	assertEquals(await exportMultibaseKey(await importJwk({
		alg: "Ed25519",
		crv: "Ed25519",
		ext: true,
		key_ops: ["verify"],
		kty: "OKP",
		x: "Lm_M42cB3HkUiODQsXRcweM6TByfzEHGO9ND274JcOY"
	}, "public")), "z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK");
});
//#endregion
export {};
