npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mmyyrroonn/ipfs-web3-authenticator

v0.1.0

Published

IPFS W3Auth is a lightweight Web3-based authentication service basedon **IPFS gateway** and **reverse proxy**

Downloads

4

Readme

IPFS W3Auth · GitHub license

IPFS W3Auth is a lightweight Web3-based authentication service basedon IPFS gateway and reverse proxy

About IPFS W3Auth

🚀 Deployment

Please make sure you have IPFS Gateway runnning locally, you can refer this doc to config the gateway information.

1. Run IPFS W3Auth

  • Run with docker
docker run -e PORT=5050 -e IPFS_ENDPOINT=http://localhost:5001 --network=host crustio/ipfs-w3auth
  • Run with node native
# 1. Clone repo
git clone https://github.com/crustio/ipfs-web3-authenticator.git

# 2. Install and build
yarn && yarn build

# 3. Run
PORT=5050 IPFS_ENDPOINT=http://localhost:5001 yarn start
  • PORT: W3Auth service listening port

  • IPFS_ENDPOINT: IPFS local API endpoint

2. Config with reverse proxy

2.1 With caddy

  • Auth both readable and writeable API
https://ipfs.example.com {
  reverse_proxy 127.0.0.1:5050
}
  • Auth only writeable API
https://ipfs.example.com {
    reverse_proxy /api/* localhost:5050 {
        header_down Access-Control-Allow-Origin *
        header_down Access-Control-Allow-Methods "POST"
        header_down Access-Control-Allow-Headers *
    }

    reverse_proxy /ipfs/* localhost:8080
}

2.2 With nginx

  • Auth both readable and writeable API
server {
    listen       80;
    listen  [::]:80;
    server_name  ipfs.example.com;


    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }


    location / {
        proxy_http_version 1.1;
        proxy_pass   http://localhost:5050/;
        proxy_set_header Host               $http_host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        add_header Cache-Control no-cache;
    }
}
  • Auth only writeable API
server {
    listen       80;
    listen  [::]:80;
    server_name  ipfs.example.com;


    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }


    location /api {
        proxy_http_version 1.1;
        proxy_pass   http://localhost:5050/api;
        proxy_set_header Host               $http_host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        add_header Cache-Control no-cache;
    }

    location / {
        proxy_http_version 1.1;
        proxy_pass   http://localhost:8080;
        proxy_set_header Host               $http_host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        add_header Cache-Control no-cache;
    }

}

🤟🏻 Usage

The IPFS W3Auth Gateway is compatible with the official IPFS API, with the same HTTP endpoints, flags and arguments. The only additional step you must take when interacting with the IPFS W3Auth Gateway API is to configure the correct Basic Authentication header.

Authorization: Basic <base64(PubKey:SignedMsg)>

Let's take cURL as an example 😎

curl -X POST -F file=@myfile -u "PubKey:SignedMsg" "https://localhost:5050/api/v0/add"

Get Auth header

You can get PubKey and SignedMsg by using the following web3-ways:

1. With Substrate

Get PubKey

PubKey is just the substrate address, like 5Chu5r5GA41xFgMXLQd6CDjz1ABGEGVGS276xjv93ApY6vD7

All substrate-based chains are adapted:

Get SignedMsg

Just sign the PubKey with your private key to get the SignedMsg

2. With Ethereum

Get PubKey

PubKey is just the ethereum address(42-characters) start with 0x

Get SignedMsgs

Just sign the PubKey with your eth private key to get the SignedMsg

3. With Solana

Comming Soon

4. With Polygon

Comming Soon

5. With Near

Comming Soon

💻 Build

Install

yarn

Run in dev mode

yarn dev

Build and run in prod mode

yarn build
yarn start

🙋🏻‍♂️ Contribute

Please feel free to send a PR

License

Apache 2.0