How to use the @decentralized-identity/sidetree.SidetreeIpfsService function in @decentralized-identity/sidetree

To help you get started, we’ve selected a few @decentralized-identity/sidetree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentralized-identity / ion / src / ipfs.ts View on Github external
// Testing commiting and pushing branches

import {
  SidetreeIpfsService,
  SidetreeResponse,
  SidetreeResponseModel
} from '@decentralized-identity/sidetree';

const config: {
  /** Port number used by the service. */
  port: number;
  /** Timeout for fetch request. */
  fetchTimeoutInSeconds: number;
} = require('../json/ipfs-config.json');

const requestHandler = new SidetreeIpfsService(config.fetchTimeoutInSeconds);
const app = new Koa();

// Raw body parser.
app.use(async (ctx, next) => {
  ctx.body = await getRawBody(ctx.req);
  await next();
});

const router = new Router();

router.get('/version', async (ctx, _next) => {
  const response = await requestHandler.handleGetVersionRequest();
  setKoaResponse(response, ctx.response);
});

router.get('/:hash', async (ctx, _next) => {

@decentralized-identity/sidetree

Node.js implementation of Sidetree.

Apache-2.0
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages