Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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 0 weekly downloads. As such, @dsnp/did-resolver popularity was classified as not popular.
We found that @dsnp/did-resolver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.