How to use did-resolver - 7 common examples

To help you get started, we’ve selected a few did-resolver 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 / element / packages / element-lib / src / func / resolve.js View on Github external
const resolve = ({
  did, reducer, storage, blockchain, transactionTime,
}) => {
  if (
    did === undefined
    || reducer === undefined
    || storage === undefined
    || blockchain === undefined
    || transactionTime === undefined
  ) {
    throw new Error('Invalid args: resolve({ did, reducer, storage, blockchain, transactionTime})');
  }

  resolver.registerMethod(method, async (_did, parsed) => {
    // {
    //   method: 'mymethod',
    //   id: 'abcdefg',
    //   did: 'did:mymethod:abcdefg/some/path#fragment=123',
    //   path: '/some/path',
    //   fragment: 'fragment=123'
    // }
    // console.log(did, parsed);
    // eslint-disable-next-line

    const updated = await syncFromBlockNumber({
      didUniqueSuffixes: [parsed.id],
      transactionTime,
      initialState: {}, // set from cache
      reducer,
      storage,
github 3box / 3box-js / src / replicator.js View on Github external
const pinDID = did => {
  if (!did) return
  // We resolve the DID in order to pin the ipfs object
  try {
    resolveDID(did)
    // if this throws it's not a DID
  } catch (e) {}
}
github decentralized-identity / element / packages / element-lib / src / func / resolve.js View on Github external
const updated = await syncFromBlockNumber({
      didUniqueSuffixes: [parsed.id],
      transactionTime,
      initialState: {}, // set from cache
      reducer,
      storage,
      blockchain,
    });
    const record = updated[parsed.id];
    if (record) {
      return record.doc;
    }
    return null;
  });

  return resolver.default(did);
};
github TangleID / TangleID / packages / did / src / mnid.js View on Github external
const decodeFromDid = tangleid => {
  const parsed = parse(tangleid);
  const mamParsed = decodeFromMnid(parsed.id);

  return mamParsed;
};

did-resolver

Resolve DID documents

Apache-2.0
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis

Similar packages