Lighthouse
  • 👋Introduction
  • Quick Start
  • How To
    • 🔑Create an API Key
    • 🔼Upload Data
      • 📁File
      • 🔤Text/JSON
      • 🔀Buffer
    • 🔒Upload Encrypted Data
      • 📁File
      • 🔤Text/JSON
      • 🔐Encryption Authentication
        • 📝Method 1: Signed Message
        • ⚕️Method 2: JWT
        • 📲Method 3: Passkey
    • Encryption Features
      • 👯Share File
      • ❌Revoke Access
      • 🔑Check Access Conditions
      • 🚪Token Gating
      • Chains Supported
      • 📃Access Control Conditions
      • 🔓Decrypt File
        • 🌐Browser Decrypt File
        • 💻NodeJS Decrypt File
      • 🚪Access control with zkTLS
      • 👬Account Delegation Tutorial
    • 📂List Files
    • 💁File Info
    • 💰Get Balance
    • 🔁Retrieve File
    • 💾Check for Filecoin Deals
    • 🔄IPNS - Handle Mutable Data
    • 📦Migrate Files
    • 📌Pin CID
    • 💸Pay per use
    • Resize Image
    • 💻Use CLI Tools
  • zkTLS
  • 🤝Account Delegation
  • 💾Filecoin First
    • Usage
    • 💰Pay Per Deal
  • Tutorials
    • 💸Pay to View Application
    • Use Python SDK
    • 📝Update Content with Lighthouse IPNS
    • 📹Add Video Player in UI
    • ✅Document Verification with PoDSI
    • 🎨Minting NFTs on EVM Chains
    • 🪙Minting NFTs on Solana
    • 👩‍💻Programmable Storage with Lighthouse SDK and Filecoin
    • 🔐Secure File Sharing
    • Upload Encrypted Files
    • 📄Token Gating and Custom Contract
    • 🔑Token Gating NFTs
    • 🏖️Pushing File Metadata Onchain
    • Use Radix Wallet on Lighthouse Filesdapp
  • Concepts
    • Glossary
    • IPFS CID Transition to v1
  • Support
    • 📞Contact
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. How To
  2. Upload Encrypted Data
  3. Encryption Authentication

Method 2: JWT

Authentication via JWT

Get JWT Token Endpoint

This endpoint allows users to retrieve a JWT (JSON Web Token) after they've signed a message with their wallet, confirming their ownership of a specific address.

Endpoint:

https://encryption.lighthouse.storage/api/message/get-jwt

Method:

POST

Request Body Parameters:

  • address: The wallet address that the user wants to prove ownership of.

  • signature: The signature generated after signing the message provided by the previous endpoint (/api/message/<walletAddress>).

Headers:

  • "Content-Type": "application/json"


Success Response:

Code: 200 OK

Content:

{
  "token": "<YOUR_JWT_TOKEN_HERE>"
}

Error Responses:

Code: 400 Bad Request

Content:

{
  "error": "Invalid address or signature"
}

Notes & Usage:

  • After obtaining the message from the /api/message/<walletAddress> endpoint, users should sign it using their Ethereum-compatible or Solana wallets. This signed message (signature) and the wallet address should then be passed to this endpoint to retrieve the JWT token.

  • The JWT token can be used for authentication in subsequent API calls within the Lighthouse Encryption system(recommend for multiple uploads or download on our encryption service).


Ensure you store the received JWT token securely and do not expose it. This token serves as a proof of authentication and could be misused if obtained by malicious actors.


With the JWT token in hand, you can now authenticate and interact with other secured endpoints in the Lighthouse system. Always remember to include the JWT in the header of your requests where authentication is required.


PreviousMethod 1: Signed MessageNextMethod 3: Passkey

Last updated 1 year ago

Was this helpful?

🔒
🔐
⚕️