Download the PHP package kaadon/peertopeer without Composer

On this page you can find all versions of the php package kaadon/peertopeer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package peertopeer

Kaadon PeerToPeer

PHP Version

一个基于 X25519 密钥交换和 AES-GCM 加密的 PHP 端到端加密库,提供安全的点对点通信解决方案。

特性

前端

本库适用于后端 PHP 环境,前端可以使用 @kaadon.com/peertopeer 结合

前端库 npm

安装

通过 Composer 安装:

系统要求

安装 Sodium 扩展

快速开始

基础用法

使用本地密钥存储

API 文档

E2EEncryption 类

构造函数

公共方法

getPublicKey()

获取当前实例的公钥(Base64 编码)

getPrivateKey()

获取当前实例的私钥(Base64 编码)

encrypt()

使用远程公钥加密消息

参数:

返回:

decrypt()

使用远程公钥解密消息

参数:

返回: 解密后的明文消息

LocalKeyStore 类

构造函数

公共方法

savePublicKey()

保存远程用户的公钥

getPublicKey()

获取指定用户的公钥

listPublicKeys()

列出所有已保存的公钥名称

deletePublicKey()

删除指定用户的公钥

hasPublicKey()

检查是否存在指定用户的公钥

使用示例

完整的通信示例

ThinkPHP 框架集成

本库支持 ThinkPHP 5.1 框架集成。安装后会自动注册配置文件。

在 ThinkPHP 中使用:

安全注意事项

⚠️ 重要安全提示:

  1. 私钥保护: 私钥必须妥善保管,绝不能泄露。建议使用安全的密钥管理系统。

  2. 公钥验证: 在实际应用中,必须通过安全渠道验证公钥的真实性,防止中间人攻击。

  3. 密钥轮换: 定期更换密钥对以提高安全性。

  4. 安全存储: 本地密钥存储文件应设置适当的文件权限(如 600)。

  5. 随机数生成: 确保系统有足够的熵源用于生成安全的随机数。

错误处理

库中定义了自定义异常类 PeerToPeerException

测试

运行测试套件:

或者直接使用 PHPUnit:

性能注意事项

故障排除

常见问题

  1. 缺少 sodium 扩展

    解决方案: 安装 php-sodium 扩展

  2. 解密失败

    可能原因:

    • 使用了错误的密钥对
    • IV 或密文被篡改
    • 密钥格式不正确
  3. 文件权限错误

    解决方案: 检查密钥存储文件的读写权限

更新日志

v1.0.0

贡献

欢迎提交 Issue 和 Pull Request!

  1. Fork 本项目
  2. 创建特性分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -am 'Add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

许可证

本项目基于 MIT 许可证开源。详见 LICENSE 文件。

联系我们

相关链接


All versions of peertopeer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
kaadon/exceptions Version ^0.0.1
ext-sodium Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kaadon/peertopeer contains the following files

Loading the files please wait ...