hhun/web3-recover

还原Web3签名消息的签名帐户

v1.0.2 2023-03-11 04:23 UTC

This package is auto-updated.

Last update: 2024-04-18 07:30:46 UTC


README

中文 | English

使用方法

JavaScript 签名消息

var msg = 'login'
var from = web3.eth.accounts[0]
web3.eth.sign(msg, from, function (err, result) {
	if (err) {
		return console.error(err);
	}
	console.log('signed: ' + result);
});

PHP恢复签名地址

use hhun\Web3Recover\Web3Recover;

$signed = '0x4cde93d4........'; // 签名内容

$msg = 'login';
echo Web3Recover::fromText($msg, $signed);

$hex = '0x6c6f67696e';
echo Web3Recover::fromHex($hex, $signed);