
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@dsnp/did-resolver
Advanced tools
This package implements a generic resolver for the dsnp
DID method (that is, DIDs of the form did:dsnp:123456
, where 123456
is a DSNP User Id in decimal format).
This resolver must be used with one or more plugins for specific DSNP systems (see below).
This package follows the conventions described in the @digitalbazaar/did-io
package and exposes a driver()
function which returns an object with a get(options)
method.
Pass an array of DSNPResolver objects to the driver()
method.
import { CachedResolver } from "@digitalbazaar/did-io";
import didDsnp from "@dsnp/did-resolver";
import { FooResolver} from "dsnp-did-resolver-plugin-foo"; // See below for known plugins
// ... additional dsnp-did-resolver plugins if needed
const resolver = new CachedResolver();
resolver.use(didDsnp.driver([ new FooResolver() ]));
const myDid = "did:dsnp:123456";
const result = await resolver.get({ did: myDid });
console.log(JSON.stringify(result, null, 2));
The CachedResolver can combine drivers for multiple DID methods as described in the did-io
documentation.
For example, if you also want to be able to resolve did:web:*
DIDs, you can use the did-method-web
driver alongside the DSNP driver.
import { CachedResolver } from "@digitalbazaar/did-io";
import didWeb from "@digitalbazaar/did-method-web";
import didDsnp from "@dsnp/did-resolver";
import { FooResolver} from "dsnp-did-resolver-plugin-foo";
const resolver = new CachedResolver();
resolver.use(didWeb.driver());
resolver.use(didDsnp.driver([ new FooResolver() ]));
// DID resolution proceeds as in previous example
To resolve a DSNP User Id to a specific DSNP system, one or more instances of system-specific plugins are required. Array ordering defines the order in which this resolver will attempt to resolve a DSNP DID. It will return the result from the first plugin that returns a DID document.
Plugins should implement the DSNPResolver
interface, which includes a resolve(bigint)
function (see index.ts
):
export interface DSNPResolver {
resolve(dsnpUserId: bigint): Promise<object | null>;
}
The resolve()
function should return null
if the DSNP User Id cannot be resolved to a DID document for any reason.
Plugins should avoid throwing errors except in dire circumstances, as errors from one plugin will cause any further plugins that have been registered to not be called.
DSNPResolver
instances are passed to this library's driver()
method as shown above.
System | Plugin package |
---|---|
Frequency | @dsnp/did-resolver-plugin-frequency |
Please submit a pull request with any additional plugins.
npm install
- install dependenciesnpm run build
- compilenpm run test
- run unit testsnpm run lint
- run linternpm run format
- reformat source filesPull requests are welcomed with an accompanying github issue.
FAQs
A DSNP DID resolver
The npm package @dsnp/did-resolver receives a total of 25 weekly downloads. As such, @dsnp/did-resolver popularity was classified as not popular.
We found that @dsnp/did-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.