From fae1ce2f152794842df1db6c29abb02b127a63a6 Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 3 Jan 2025 18:46:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 2 +- package.json | 2 +- src/index.d.ts | 13 +++++-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Readme.md b/Readme.md index ce2734d..6822dad 100644 --- a/Readme.md +++ b/Readme.md @@ -2,7 +2,7 @@ > 本模块是对原生的`crypto`模块二次封装的,在使用上更加简单方便。 ## 更新日志 -+ v3.3.2 ++ v3.3.3 - 优化`.d.ts`参数声明 + v3.3.1 diff --git a/package.json b/package.json index e8331f3..a63feca 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "crypto.js", "type": "module", - "version": "3.3.2", + "version": "3.3.3", "description": "原生crypto加密模块的二次封装,简化常用加密函数的使用", "keywords": [ "md5", diff --git a/src/index.d.ts b/src/index.d.ts index 60d4298..3c03974 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -3,16 +3,17 @@ * @author yutent * @date 2024/12/12 15:41:25 */ -import crypto from 'crypto' declare module 'crypto.js' { + import crypto from 'node:crypto' + // 原生 crypto 模块 - export const crypto: crypto + export { crypto } /** - * @deprecated('use crypto instead') + * @deprecated Use `crypto` instead. */ - export const origin: crypto + export const origin: typeof crypto // 随机数生成 export function rand(len: number, forceNum?: boolean): string @@ -36,10 +37,6 @@ declare module 'crypto.js' { export function sha256Sign(path: string, encode?: string): string | Buffer - export function sha1(data: string, encode?: string): string | Buffer - - export function sha1Sign(path: string, encode?: string): string | Buffer - export function sha512(data: string, encode?: string): string | Buffer export function sha512Sign(path: string, encode?: string): string | Buffer