首页 > 解决方案 > 签名到期日

问题描述

我正在签署一个任意字符串

const ts = Date.now();
const hash = await web3.utils.sha3(anystring+ts);
const sign = await web3.eth.personal.sign(hash, account);

并检查地址

const address = await web3.eth.accounts.recover(hash, sign);

问题是,这个签名永远有效。

如何引入和到期日期/时间?

标签: ethereumsignatureweb3public-key

解决方案


必须在应用程序级别检查签名到期。

消息本身必须包含消息有效时长的有效负载。

然后应用程序在检查签名后检查时间戳。


推荐阅读