From da48d916777b015cedc6e6a3e5a2ffed551918ab Mon Sep 17 00:00:00 2001 From: Daniel Freytag Date: Mon, 16 Dec 2024 15:40:48 +0100 Subject: [PATCH] fix: optimize JSDoc for Deno --- crypto/CHANGELOG.md | 4 ++++ crypto/deno.jsonc | 2 +- crypto/hash.ts | 12 ++++++------ crypto/hmac.ts | 18 +++++++++--------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/crypto/CHANGELOG.md b/crypto/CHANGELOG.md index c14239b..3f5ac43 100644 --- a/crypto/CHANGELOG.md +++ b/crypto/CHANGELOG.md @@ -1,5 +1,9 @@ # Crypto Changelog +## 2024-12-16 - 0.0.3 + +- fix: optimize JSDoc for Deno + ## 2024-12-16 - 0.0.2 - fix: optimize key handling for HMAC diff --git a/crypto/deno.jsonc b/crypto/deno.jsonc index e00fa98..b4d3b53 100644 --- a/crypto/deno.jsonc +++ b/crypto/deno.jsonc @@ -1,7 +1,7 @@ { "$schema": "https://jsr.io/schema/config-file.v1.json", "name": "@frytg/crypto", - "version": "0.0.2", + "version": "0.0.3", "exports": { "./hash": "./hash.ts", "./hmac": "./hmac.ts" diff --git a/crypto/hash.ts b/crypto/hash.ts index cdc05a5..934ddc4 100644 --- a/crypto/hash.ts +++ b/crypto/hash.ts @@ -1,10 +1,6 @@ -import { createHash } from 'node:crypto' - -const HEX_ENCODING = 'hex' - /** - * @module hash - * SHA-256 and SHA-512 hash functions + * @module + * {@linkcode hashSha256 | SHA-256} and {@linkcode hashSha512 | SHA-512} hash functions * * @example * ```ts @@ -14,6 +10,10 @@ const HEX_ENCODING = 'hex' * ``` */ +import { createHash } from 'node:crypto' + +const HEX_ENCODING = 'hex' + /** * Returns a SHA-256 hash of the input string (as hexadecimal string) * @param str - The string to hash diff --git a/crypto/hmac.ts b/crypto/hmac.ts index d7c56d6..5bff835 100644 --- a/crypto/hmac.ts +++ b/crypto/hmac.ts @@ -1,13 +1,6 @@ -// load package -import { Buffer } from 'node:buffer' -import { createHmac } from 'node:crypto' - -const HEX_ENCODING = 'hex' -const HEX_REGEX = /^[0-9a-fA-F]*$/ - /** - * @module hmac - * HMAC SHA-256 and SHA-512 hash functions + * @module + * {@linkcode hmacSha256 | HMAC SHA-256} and {@linkcode hmacSha512 | HMAC SHA-512} hash functions * * @example * ```ts @@ -17,6 +10,13 @@ const HEX_REGEX = /^[0-9a-fA-F]*$/ * ``` */ +// load package +import { Buffer } from 'node:buffer' +import { createHmac } from 'node:crypto' + +const HEX_ENCODING = 'hex' +const HEX_REGEX = /^[0-9a-fA-F]*$/ + /** * Returns a HMAC SHA-256 hash of the input string (as hexadecimal string) * @param str - The string to hash