承接 kriptonix/laravel-nostr-auth 相关项目开发

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

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

kriptonix/laravel-nostr-auth

Composer 安装命令:

composer require kriptonix/laravel-nostr-auth

包简介

Use Nostr bowrser extension to login to Laravel Application

README 文档

README

GitHub contributors GitHub issues GitHub last commit (branch)

This package allows users to log in to Laravel application using Nostr browser key management extensions (e.g., Alby). It enables users to authenticate by signing a message with their private key and sending the signature and public key for verification. If the verification is successful and the user is not registered in the Laravel application, the package will register the user, adding them to the users table with the corresponding public key. If the user with given public key is already registered in will be logged in.

More info about Nostr: https://github.com/nostr-protocol/nostr.

Features

  • Log in or register using Nostr browser key management extensions
  • Automatically register new users with their public key
  • Default email set to '@nostr.io'
  • Default name set to 'Nostr User'
  • Default password set to a hash of a random integer (not cryptographically secure)
  • You can set where you want to redirect users after successful login in config/nostr-auth.php
  • You can customize user registration details in the NostrAuthController
  • You can disable default authentication via email/password if desired

Installation

To use the package in your Laravel project it is recommended to install authentication starter kits as they provide many additional features. Allthough the package will work with Laravel's built-in authentication services without starter pack you might need to tweek it a bit to adopt it to your needs.

Install the package with composer:

$ composer require kriptonix/laravel-nostr-auth

Install dependencies if you would like to test / code some things out for yourself.

$ composer install

Publish the configuration file:

$ php artisan vendor:publish --provider="Kriptonix\LaravelNostrAuth\LaravelNostrAuthServiceProvider" --tag="config"

Publish the migration file:

$ php artisan vendor:publish --provider="Kriptonix\LaravelNostrAuth\LaravelNostrAuthServiceProvider" --tag="migrations"

Run the migrations:

$ php artisan migrate

Add 'pubkey' to $fillable property of User model:

protected $fillable = [
        // ... other fields
        'pubkey'
    ];

Add @stack('scripts') to layout views or static HTML pages where you want to show the "Login with Nostr" button/link.

Note: For the script to work, csrf_token should be used. When implementing the login button on static HTML pages, include the following in the section:

<meta name="csrf-token" content="{{ csrf_token() }}">

Add the login button:

<x-nostrauth::nostr-login-button />

When user clicks this button Nostr browser extension (i.e. Alby) will pop up so that user can confirm and sign a simple event message. After signing, if user with public key that signed the message exists the package will authenticate and log in the user. If user doesn't exist the package will create and log in the user.

Customization

If you would like to change the HTML of the login button, you can modify the view component located at:

vendor/kriptonix/laravel-nostr-auth/resources/views/components/nostr-login-button.blade.php

Usage

Logging In

Users can log in by clicking the "Login with Nostr" button, which will use their Nostr browser key management extension to sign a message and send the signature and public key for verification.

Registration

If the user is not already registered:

  • They will be registered with their public key
  • The email will be set to @nostr.io
  • The name will be set to 'Nostr User'
  • The password will be set to a hash of a random integer (not cryptographically secure)
  • You can handle password security and other default user creation details by modifying the NostrAuthController

Disabling Default Authentication

If you prefer to use only the Nostr authentication method, you can disable the default email/password authentication in your Laravel application.

Contributing

Contributions are welcome! Please feel free to submit a pull request.

License

This package is open-sourced software licensed under the MIT license.

Community

If you need any help, please contact me via Nostr npub1ap9fscjl92zclacmaa0nneurr5js85ymuem6ew0ftu8f6eztvpds8qchga

Funding

If you would like to support this project with a donation, you could send some lightning sats to plebeian@getalby.com.

Maintainers

  • @kriptonix npub1ap9fscjl92zclacmaa0nneurr5js85ymuem6ew0ftu8f6eztvpds8qchga (original author)

kriptonix/laravel-nostr-auth 适用场景与选型建议

kriptonix/laravel-nostr-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 kriptonix/laravel-nostr-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kriptonix/laravel-nostr-auth 我们能提供哪些服务?
定制开发 / 二次开发

基于 kriptonix/laravel-nostr-auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-20