zbkm/siwe
最新稳定版本:v0.5.0
Composer 安装命令:
composer require zbkm/siwe
包简介
Ethereum Authentication for PHP
README 文档
README
This package provides a PHP implementation of EIP-4361: Sign In With Ethereum.
Installation
composer require zbkm/siwe
Usage
- The wallet is connected to the client, then the wallet address is sent to the server
- On the server we generate SIWE messages.
$params = new SiweMessageParams( address: $address, chainId: 1, domain: "example.com", uri: "https://example.com/path" );
or with params builder:
$params = SiweMessageParamsBuilder::create() ->withAddress($address) ->withChainId(1) ->withDomain("example.com") ->withUri("https://example.com/path")->build();
And we generate the message text:
$message = SiweMessage::create($params);
- On the client side, we sign the SIWE message via personal_sign. We send the received signature to the server.
- All that remains is to check the signature.
if (SiweMessage::verify($params, $signature)) { // authorization success } else { // authorization failed (signature invalid) }
You can also look at a fully working example of authorization using the library.
Links
统计信息
- 总下载量: 270
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-06