ethereum - 签名到期日
问题描述
我正在签署一个任意字符串
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);
问题是,这个签名永远有效。
如何引入和到期日期/时间?
解决方案
必须在应用程序级别检查签名到期。
消息本身必须包含消息有效时长的有效负载。
然后应用程序在检查签名后检查时间戳。
推荐阅读
- cron - 从 puppet 的 cronjob 资源中,我只想将 cron 作业错误日志附加到不同的路径
- python - 在 CNN 中使用全局总和池化而不是全局平均池化
- r - 向分类水平条形图添加垂直虚线
- javascript - 删除 beforeunload 确认弹出窗口
- apache-spark - 当一个查询插入和一个同时更改同一张表时会发生什么?
- swift - Tableview 中的 Collectionview - 图像未出现在集合视图中
- python - 我应该如何为数据集建模以预测 y_test 值?
- python - Tradingview_ta 指标的间隔变化
- javascript - 为什么当我使用 ts-node 运行脚本时 for..in 不起作用?
- flutter - 颤振更新状态问题与 setState()