Skip to content

Using Solid to store IPFS Hash privately or publicly

License

Notifications You must be signed in to change notification settings

kustomzone/solid-ipfs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

Using Solid to store IPFS Hash privately or publicly

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%