From decdcab1e5a9a4b6d6930228245ae130d0551e94 Mon Sep 17 00:00:00 2001 From: Luk Date: Mon, 14 Oct 2024 15:23:50 +0800 Subject: [PATCH] crypto.randomUUID().replace(/-/g,'').substring(0,12) --- package.json | 3 +-- ticc.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 12f2774..ac479cd 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,7 @@ "js-crypto-key-utils": "^1.0.4", "keccak": "^3.0.2", "secp256k1": "^4.0.3", - "tweetnacl": "^1.0.3", - "uuid": "^8.3.2" + "tweetnacl": "^1.0.3" }, "devDependencies": { "docdash": "^1.2.0", diff --git a/ticc.js b/ticc.js index 8886ef7..9b0414e 100644 --- a/ticc.js +++ b/ticc.js @@ -4,7 +4,7 @@ const crypto = require('crypto') const nacl = require('tweetnacl') const bs58check = require('bs58check') const bs58 = require('bs58') // bs58check depends on bs58 -const uuid = require('uuid') +//const uuid = require('uuid') const keccak = require('keccak') const ecc = require('eccrypto-js') // 用于加解密。eccrypto 在 windows 上和 openssl 的版本兼容性有点麻烦,所以换用 eccrypto-js const keyman = require('js-crypto-key-utils') // 转换原始密钥和 PER/DER 格式。 @@ -1026,7 +1026,7 @@ class TicCrypto { * @memberof TicCrypto */ static randomize_uuid () { - return uuid.v4() + return crypto.randomUUID() // uuid.v4() } /**