Package Exports
- solid-ipfs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (solid-ipfs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
solid-hash
Using Solid to store IPFS Hash privately or publicly.
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/
.
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
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
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();