agustind/ethsignature

v1.0.2 2022-10-04 12:42 UTC

This package is auto-updated.

Last update: 2024-09-05 12:01:34 UTC


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

用以太坊捐款 🙏

Ethereum 0x8cA54b378C177db1cfde63231f9eA32fa7943036