承接 dragu/siwe 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dragu/siwe

Composer 安装命令:

composer require dragu/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

  1. The wallet is connected to the client, then the wallet address is sent to the server
  2. 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);
  1. On the client side, we sign the SIWE message via personal_sign. We send the received signature to the server.
  2. 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

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-11