Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@catalist-nestjs/ipfs-http-client

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@catalist-nestjs/ipfs-http-client

Simple http ipfs client. Part of [Catalist NestJS Modules](https://github.com/blockarchivelabs/catalist-nestjs-modules/#readme).

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Library for storing keys in IPFS and creating merkle tree

Simple http ipfs client. Part of Catalist NestJS Modules.

Install

yarn add @catalist-nestjs/ipfs-http-client

Ipfs

Usage

This module depends on FetchModule from @catalist-nestjs/fetch, so you need to provide it as a global module or import it into IpfsModule.

Sync usage
// Import
import { Module } from '@nestjs/common';
import { IpfsModule } from '@catalist-nestjs/offchain-key-storage-client';
import { FetchModule } from '@catalist-nestjs/fetch';
import { MyService } from './my.service';

@Module({
  imports: [
    IpfsModule.forFeature({
      imports: [FetchModule],
      url: 'http://127.0.0.1:5001/api/v0',
      username: 'username',
      password: 'password',
    }),
  ],
  providers: [MyService],
  exports: [MyService],
})
export class MyModule {}

// Provider usage
import { IpfsGeneralService } from '@catalist-nestjs/offchain-key-storage-client';

export class MyService {
  constructor(private ipfsService: IpfsGeneralService) {}

  async myMethod() {
    return await this.ipfsService.get(
      'QmSJiSS956mnxk2UhWo5T7CqCebeDAS4BrnjuBM6VAeheT',
      'http://127.0.0.1:5001/api/v0',
    );
  }
}

Async usage

@Module({
  imports: [
    ConfigModule,
    // FetchModule.forRoot(),
    IpfsModule.forFeatureAsync({
      imports: [CustomFetchModule],
      async useFactory(config: ConfigService) {
        return {
          url: config.get('URL'),
          username: config.get('USERNAME'),
          password: config.get('PASSWORD'),
        };
      },
      inject: [ConfigService],
    }),
  ],
})
export class MyModule {}

Global usage

import { Module } from '@nestjs/common';
import { IpfsModule } from '@catalist-nestjs/offchain-key-storage-client';
import { FetchModule } from '@catalist-nestjs/fetch';

@Module({
  imports: [
    IpfsModule.forRoot({
      imports: [FetchModule],
      url: 'http://127.0.0.1:5001/api/v0',
      username: 'username',
      password: 'password',
    }),

    // IpfsModule.forRootAsync({
    //   imports: [CustomFetchModule],
    //   async useFactory(config: ConfigService) {
    //     return {
    //       url: config.get('URL'),
    //       username: config.get('USERNAME'),
    //       password: config.get('PASSWORD'),
    //     };
    //   },
    //   inject: [ConfigService],
    // }),
  ],
})
export class MyModule {}

Example of usage this library https://github.com/blockarchivelabs/catalist-offchain-key-lib-test.git

Keywords

FAQs

Package last updated on 30 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc