GithubHelp home page GithubHelp logo

kustomzone / solid-ipfs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eximua/solid-ipfs

1.0 2.0 0.0 688 KB

Using Solid to store IPFS Hash privately or publicly

License: MIT License

JavaScript 100.00%
solid unsilod

solid-ipfs's Introduction

solid-ipfs

Using Solid to store IPFS Hash privately or publicly.

You need to have a solid account to use solid-ipfs. If you don't already have one, please click here to register.

Install

$ npm install solid-ipfs --save

Usage

import SolidIPFS from 'solid-ipfs';

const main = async () => {
    const solidIpfs = new SolidIPFS({
        url: 'YOUR_SOLID_URL', // e.g. https://alicea.solid.authing.cn/inbox/
    });

    const result = await solidIpfs.storeHash({
        hash: 'YOUR_IPFS_HASH',
    });

    console.log(result, result ? '保存成功' : '保存失败');
}

main();

Then you can get IPFS hash list via <YOURL_SOLID_URL>/ipfs/hash/.

If you don't have a solid account, please click here to register.

In Solid, the path with the suffix inbox is a private data storage area. Others are public and profile, all publicly accessible. So if you want to privatize the store, use inbox , otherwise you can choose public or profile.

Private path example

  1. https://alicea.solid.authing.cn/inbox/
import SolidIPFS from 'solid-ipfs';

const main = async () => {
    const solidIpfs = new SolidIPFS({
        url: 'https://alicea.solid.authing.cn/inbox/', // inbox -> private
    });

    const result = await solidIpfs.storeHash({
        hash: 'YOUR_IPFS_HASH',
    });

    console.log(result, result ? '保存成功' : '保存失败');
}

main();

Public path example

  1. https://alicea.solid.authing.cn/profile/
  2. https://alicea.solid.authing.cn/public/
import SolidIPFS from 'solid-ipfs';

const main = async () => {
    const solidIpfs = new SolidIPFS({
        url: 'https://alicea.solid.authing.cn/public/', // public -> public
    });

    const result = await solidIpfs.storeHash({
        hash: 'YOUR_IPFS_HASH',
    });

    console.log(result, result ? '保存成功' : '保存失败');
}

main();

Using with Authing

Authing is an identity for EVERYONE and EVERYTHING, which likes Auth0.

We have integrated authing so that you can see statistics in the Authing dashboard after logging in/registering solid.

import SolidIPFS from 'solid-ipfs';

const main = async () => {
    const solidIpfs = new SolidIPFS({
        url: 'https://alicea.solid.authing.cn/inbox/', // inbox -> private
        clientId: '<YOUR_AUTHING_CLIENT_ID>',
        secret: '<YOUR_AUTHING_CLIENT_SECRET>',
    });

    await solidIpfs.initInstance(); // MUST

    const result = await solidIpfs.storeHash({
        hash: 'YOUR_IPFS_HASH',
    });

    console.log(result, result ? '保存成功' : '保存失败');
}

main();

solid-ipfs's People

Contributors

leinue avatar

Stargazers

Andrew Kidoo avatar

Watchers

Andrew Kidoo avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.