agustind / ethsignature
v1.0.2
2022-10-04 12:42 UTC
Requires
- php: >=7.3
- kornrunner/keccak: ^1.1
- simplito/elliptic-php: ^1.0
README
如果您想通过以太坊钱包从PHP验证用户,或者将某些服务器端功能仅限于允许的钱包,您可以使用Ethers.js或Web3.js等库在前端请求签名,并将钱包地址和签名作为参数传递给服务器。此库将验证签名是否有效,并且确实是由指定的钱包创建的。
用法
composer require agustind/ethsignature
<?php use Agustind\Ethsignature; $signature = new Ethsignature(); // from the frontend (via Ethers.js or Web3.js) // the wallet 0x123456789 signs the message 'hello world' // and generates the signature string 'xxxxyyyyzzzz' $is_valid = $signature->verify('hello world', 'xxxxyyyyzzzz', '0x123456789'); // true
用以太坊捐款 🙏