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

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