rename ticc.sign/verify/encrypt/decrypt/hash to ticc.xxx_easy

This commit is contained in:
陆柯 2022-07-23 16:03:17 +08:00
parent 0bc2108351
commit 94152ec736
3 changed files with 8 additions and 8 deletions

4
btc.js
View File

@ -92,10 +92,10 @@ class BTC {
} }
static encrypt (data, key) { static encrypt (data, key) {
if (!data || !key) throw new Error('Required Params Missing') if (!data || !key) throw new Error('Required Params Missing')
return ticc.encrypt(data, key) return ticc.encrypt_easy({ data, key })
} }
static decrypt (data, key) { static decrypt (data, key) {
return ticc.decrypt(data, key, { format: 'json' }) //return null for wrong key return ticc.decrypt_easy(data, key, { format: 'json' }) //return null for wrong key
} }
static isValidAddress (address) { static isValidAddress (address) {
return address.length == 34 && address[0] == '1' return address.length == 34 && address[0] == '1'

4
eth.js
View File

@ -233,10 +233,10 @@ class ETH {
} }
static encrypt (data, key) { static encrypt (data, key) {
if (!data || !key) throw new Error('Required Params Missing') if (!data || !key) throw new Error('Required Params Missing')
return ticc.encrypt(data, key) return ticc.encrypt_easy({ data, key })
} }
static decrypt (data, key) { static decrypt (data, key) {
return ticc.decrypt(data, key, { format: 'json' }) //return null for wrong key return ticc.decrypt_easy(data, key, { format: 'json' }) //return null for wrong key
} }
static async estimateGasPrice () { static async estimateGasPrice () {
try { try {

8
tic.js
View File

@ -86,10 +86,10 @@ class TIC {
} }
static encrypt (data, key) { static encrypt (data, key) {
if (!data || !key) throw new Error('Required Params Missing') if (!data || !key) throw new Error('Required Params Missing')
return ticc.encrypt(data, key) return ticc.encrypt_easy({ data, key })
} }
static decrypt (data, key) { static decrypt (data, key) {
return ticc.decrypt(data, key, { format: 'json' }) //return null for wrong key return ticc.decrypt_easy(data, key, { format: 'json' }) //return null for wrong key
} }
static isValidAddress (address) { static isValidAddress (address) {
@ -144,10 +144,10 @@ class TIC {
} }
//default key for sign&encrypt is account's seckey,other keys are optional. //default key for sign&encrypt is account's seckey,other keys are optional.
sign (message, key = this.seckey) { sign (message, key = this.seckey) {
return ticc.sign({ data: message, seckey: key }) return ticc.sign_easy({ data: message, seckey: key })
} }
verify (message, signature) { verify (message, signature) {
return ticc.sign({ data: message, signature, seckey: this.seckey }) return ticc.sign_easy({ data: message, signature, seckey: this.seckey })
} }
encrypt (key) { encrypt (key) {
return TIC.encrypt(this, key) return TIC.encrypt(this, key)