support uuid v4 kid

This commit is contained in:
Nebel 2023-07-12 19:57:18 +09:00
parent 69897675e5
commit a3d544d913
Signed by: nebel
GPG key ID: 79807D08C6EF6460
2 changed files with 6 additions and 2 deletions

View file

@ -55,6 +55,8 @@
<option value="rfc9278-s384">JWK Thumbprint URI (SHA-384)</option> <option value="rfc9278-s384">JWK Thumbprint URI (SHA-384)</option>
<option value="rfc9278-s512">JWK Thumbprint URI (SHA-512)</option> <option value="rfc9278-s512">JWK Thumbprint URI (SHA-512)</option>
<option value="date-time">Date and Time</option> <option value="date-time">Date and Time</option>
<option value="uuid">UUID</option>
<option value="uuid-uri">UUID URI</option>
<option value="">-</option> <option value="">-</option>
</select> </select>
</label> </label>

View file

@ -27,12 +27,14 @@ async function onSubmit(e: SubmitEvent) {
"rfc9278-s384": () => calculateJwkThumbprintUri(jwk, "sha384"), "rfc9278-s384": () => calculateJwkThumbprintUri(jwk, "sha384"),
"rfc9278-s512": () => calculateJwkThumbprintUri(jwk, "sha512"), "rfc9278-s512": () => calculateJwkThumbprintUri(jwk, "sha512"),
"date-time": () => new Date().toISOString(), "date-time": () => new Date().toISOString(),
uuid: () => crypto.randomUUID(),
"uuid-uri": () => `urn:uuid:${crypto.randomUUID()}`,
}[data.get("kid-method") as string]; }[data.get("kid-method") as string];
const kid = await createKid?.(); const kid = await createKid?.();
privateKeyOutput.textContent = JSON.stringify( privateKeyOutput.textContent = JSON.stringify(
{ ...{ alg, use, kid }, ...jwk }, { ...{ alg, use, kid }, ...jwk },
null, null,
" " " ",
); );
publicKeyOutput.textContent = JSON.stringify( publicKeyOutput.textContent = JSON.stringify(
{ {
@ -40,7 +42,7 @@ async function onSubmit(e: SubmitEvent) {
...(await exportJWK(publicKey)), ...(await exportJWK(publicKey)),
}, },
null, null,
" " " ",
); );
} }