From a90ff2d4fd96f1e02e6b45dcfcaaeb62dc9ab1d5 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Sat, 6 Jul 2024 16:10:49 +0900 Subject: [PATCH] chore(utils/jwt): add `@module` docs (#3101) --- src/utils/jwt/jwa.ts | 7 +++++-- src/utils/jwt/jws.ts | 9 ++++++--- src/utils/jwt/jwt.ts | 6 ++++++ src/utils/jwt/types.ts | 5 +++++ src/utils/jwt/utf8.ts | 5 +++++ 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/utils/jwt/jwa.ts b/src/utils/jwt/jwa.ts index 8512b811c..c874a7149 100644 --- a/src/utils/jwt/jwa.ts +++ b/src/utils/jwt/jwa.ts @@ -1,5 +1,8 @@ -// JSON Web Algorithms (JWA) -// https://datatracker.ietf.org/doc/html/rfc7518 +/** + * @module + * JSON Web Algorithms (JWA) + * https://datatracker.ietf.org/doc/html/rfc7518 + */ export enum AlgorithmTypes { HS256 = 'HS256', diff --git a/src/utils/jwt/jws.ts b/src/utils/jwt/jws.ts index a2af58b30..6f3cebfac 100644 --- a/src/utils/jwt/jws.ts +++ b/src/utils/jwt/jws.ts @@ -1,12 +1,15 @@ +/** + * @module + * JSON Web Signature (JWS) + * https://datatracker.ietf.org/doc/html/rfc7515 + */ + import { getRuntimeKey } from '../../helper/adapter' import { decodeBase64 } from '../encode' import type { SignatureAlgorithm } from './jwa' import { CryptoKeyUsage, JwtAlgorithmNotImplemented } from './types' import { utf8Encoder } from './utf8' -// JSON Web Signature (JWS) -// https://datatracker.ietf.org/doc/html/rfc7515 - type KeyImporterAlgorithm = Parameters[2] type KeyAlgorithm = | AlgorithmIdentifier diff --git a/src/utils/jwt/jwt.ts b/src/utils/jwt/jwt.ts index aa74164c0..b53840cc7 100644 --- a/src/utils/jwt/jwt.ts +++ b/src/utils/jwt/jwt.ts @@ -1,3 +1,9 @@ +/** + * @module + * JSON Web Token (JWT) + * https://datatracker.ietf.org/doc/html/rfc7519 + */ + import { decodeBase64Url, encodeBase64Url } from '../../utils/encode' import { AlgorithmTypes } from './jwa' import type { SignatureAlgorithm } from './jwa' diff --git a/src/utils/jwt/types.ts b/src/utils/jwt/types.ts index 6278bdf21..208b50b12 100644 --- a/src/utils/jwt/types.ts +++ b/src/utils/jwt/types.ts @@ -1,3 +1,8 @@ +/** + * @module + * Type definitions for JWT utilities. + */ + export class JwtAlgorithmNotImplemented extends Error { constructor(alg: string) { super(`${alg} is not an implemented algorithm`) diff --git a/src/utils/jwt/utf8.ts b/src/utils/jwt/utf8.ts index 01d1972a1..f0e8065c9 100644 --- a/src/utils/jwt/utf8.ts +++ b/src/utils/jwt/utf8.ts @@ -1,2 +1,7 @@ +/** + * @module + * Functions for encoding/decoding UTF8. + */ + export const utf8Encoder: TextEncoder = new TextEncoder() export const utf8Decoder: TextDecoder = new TextDecoder()