Skip to content

Integration with Nostr Login #34564

@Zig-VS-TypeScript-VS

Description

@Zig-VS-TypeScript-VS

Feature Description

Overview

We're requesting Gitea Issues to add support for the Nostr protocol for login. This would enable users to securely and privately log into Gitea using their Nostr key pair, leveraging the benefits of Nostr's decentralized authentication.

Why Nostr NIP Login?

  • Decentralized Identity:
    Users wouldn't rely on centralized identity providers (like GitHub or Google). Their identity would be controlled by their own Nostr key pair.

  • Privacy Protection:
    Users wouldn't need to expose personal identifying information (like email addresses or phone numbers) during login. Authentication would occur solely via their public key.

  • Censorship Resistance:
    Nostr's decentralized nature makes it more resistant to censorship, meaning user identities are less likely to be easily blocked or deleted.

  • Unified Identity:
    Users could use the same Nostr identity to log in and interact with various Nostr-enabled applications and services.

  • Simplified Process:
    For users who already have a Nostr key, the login process would be much more convenient, eliminating the need to register new accounts or remember extra passwords.

Feature Description

Login Option

  • Add a "Log in with Nostr" option to the Gitea login page.

Nostr Key Pair Verification

  1. Initiate Login:
    When a user clicks "Log in with Nostr," Gitea would generate a random, time-sensitive challenge.

  2. Challenge Delivery:
    Gitea sends this challenge to the user's Nostr client (via a NIP-07 browser extension, mobile app, or desktop application).

  3. User Action:
    The user will sign the challenge within their Nostr client using their private key.

  4. Response:
    The signed message is returned to the Gitea server.

  5. Verification:
    The Gitea server verifies the signature's validity using the user's Nostr public key.

  6. Successful Login:
    Upon successful verification, the user is logged into Gitea.

User Association

  • First-time Login:

    • Offer an option to link the user's Nostr public key to an existing Gitea account or to create a new one.
  • Account Creation:

    • If a new account is created, Gitea could use the user's Nostr public key as their unique identifier and offer the option to set a Gitea username.
  • Multiple Nostr Public Key Association:

    • Allow users to link multiple Nostr public keys to the same Gitea account to handle scenarios such as lost or rotated keys.
  • Display Public Key:

    • Show the user's Nostr public key on their Gitea profile page for easy following or verification by other users.
  • Optional Nostr NIP-05 Verification:

    • Support NIP-05 (which allows users to verify their Nostr public key's association with a specific domain via DNS records) to increase identity reliability.
    • Display the NIP-05 verification status on the user's profile.
  • Secure Logout:

    • Ensure that standard Gitea session management and logout procedures are compatible with the Nostr login flow.

Security and Privacy Features

  • No Password Storage:

    • The Gitea server doesn't need to store user passwords, reducing the risk of data breaches.
  • User-Controlled Keys:

    • The user's Nostr private key remains on their device or client; Gitea never gains access to it.
  • Challenge-Response Mechanism:

    • Every login uses a unique, time-sensitive challenge, preventing replay attacks.
  • No PII Disclosure:

    • Gitea only receives and verifies the user's Nostr public key and signature; it does not acquire personal data like email addresses or phone numbers.
  • Privacy-Preserving Public Identity:

    • The Nostr public key is pseudonymous unless the user links it to a specific identity (e.g., via NIP-05 or by making it public on their profile).
  • Protection Against Identity Theft:

    • Even if the Gitea server is compromised, attackers cannot impersonate users without access to their private keys.
  • Decentralized Auditability:

    • The transparency of the Nostr protocol allows community auditing, fostering trust in the system.
  • Future Extensibility:

    • This design, being compatible with Nostr NIPs, lays the groundwork for future integrations (e.g., Nostr publishing for issue updates or comments).
  • Granular Permissions:

    • Gitea may manage permissions for Nostr-logged-in users through its standard permissions system, integrating them seamlessly into existing user management processes.

Implementation Considerations

  • NIP-07 Browser Extension Integration:

    • Prioritize integration with the most common Nostr login method.
  • User Experience:

    • Ensure the login process is clear and straightforward, even for users new to Nostr.
  • Error Handling:

    • Provide clear error messages to help users resolve login issues.
  • Compatibility:

    • Ensure that the Nostr login method works alongside existing Gitea account systems, permission management, and audit logs.
  • Documentation:

    • Furnish detailed documentation for configuring and using the Nostr login feature.

Expected Benefits

  • Enhance Gitea's security and privacy protection.
  • Attract users who value decentralization and privacy.
  • Strengthen Gitea's reputation as an open and free software platform.
  • Promote the development and adoption of the Nostr ecosystem.

We believe integrating Nostr NIP login would be a significant step toward making Gitea even more secure, private, and decentralized.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions