Compare commits

...

3 Commits

Author SHA1 Message Date
yutent 6313b9c0a8 添加MIT开源协议 2025-01-03 18:51:24 +08:00
yutent fae1ce2f15 修复声明 2025-01-03 18:46:51 +08:00
yutent a740ad2f73 优化index.d.ts 2025-01-03 18:25:00 +08:00
4 changed files with 40 additions and 5 deletions

21
LICENSE copy Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -2,6 +2,11 @@
> 本模块是对原生的`crypto`模块二次封装的,在使用上更加简单方便。 > 本模块是对原生的`crypto`模块二次封装的,在使用上更加简单方便。
## 更新日志 ## 更新日志
+ v3.3.4
- 添加MIT开源协议
+ v3.3.3
- 优化`.d.ts`参数声明
+ v3.3.1 + v3.3.1
- 优化`.d.ts`参数声明 - 优化`.d.ts`参数声明

View File

@ -1,7 +1,7 @@
{ {
"name": "crypto.js", "name": "crypto.js",
"type": "module", "type": "module",
"version": "3.3.1", "version": "3.3.4",
"description": "原生crypto加密模块的二次封装,简化常用加密函数的使用", "description": "原生crypto加密模块的二次封装,简化常用加密函数的使用",
"keywords": [ "keywords": [
"md5", "md5",
@ -19,6 +19,7 @@
"type": "git", "type": "git",
"url": "https://git.wkit.fun/bytedo/crypto.js.git" "url": "https://git.wkit.fun/bytedo/crypto.js.git"
}, },
"license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"files": [ "files": [
@ -28,6 +29,7 @@
"start": "node ./build.js" "start": "node ./build.js"
}, },
"exports": { "exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js", "require": "./dist/index.js",
"import": "./dist/index.mjs" "import": "./dist/index.mjs"
} }

15
src/index.d.ts vendored
View File

@ -3,7 +3,18 @@
* @author yutent<yutent.io@gmail.com> * @author yutent<yutent.io@gmail.com>
* @date 2024/12/12 15:41:25 * @date 2024/12/12 15:41:25
*/ */
declare module 'crypto.js' { declare module 'crypto.js' {
import crypto from 'node:crypto'
// 原生 crypto 模块
export { crypto }
/**
* @deprecated Use `crypto` instead.
*/
export const origin: typeof crypto
// 随机数生成 // 随机数生成
export function rand(len: number, forceNum?: boolean): string export function rand(len: number, forceNum?: boolean): string
@ -26,10 +37,6 @@ declare module 'crypto.js' {
export function sha256Sign(path: string, encode?: string): string | Buffer 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 sha512(data: string, encode?: string): string | Buffer
export function sha512Sign(path: string, encode?: string): string | Buffer export function sha512Sign(path: string, encode?: string): string | Buffer