crypto.randomUUID().replace(/-/g,'').substring(0,12)

This commit is contained in:
Luk 2024-10-14 15:23:50 +08:00
parent ced82b18d7
commit decdcab1e5
2 changed files with 3 additions and 4 deletions

View File

@ -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",

View File

@ -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()
}
/**