# did-uri

> Decentralized Identity (DID) URI parser and formatter

Latest version **0.6.0** (published 2022-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install did-uri
pnpm add did-uri
yarn add did-uri
bun add did-uri
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2022-04-06 |
| First published | 2018-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 21.2 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | Joseph Werle |
| Maintainers | werle, vipyne |
| Keywords | decentralized, identity, did, uri, parse, stringify, format |

## Links

- npm: https://www.npmjs.com/package/did-uri
- Repository: https://github.com/jwerle/did-uri
- Homepage: https://github.com/jwerle/did-uri#readme
- Issues: https://github.com/jwerle/did-uri/issues
- npm.io page: https://npm.io/package/did-uri

## Dependencies (1)

- [qs](https://npm.io/package/qs.md) 6.5.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.6.0 (latest) — 2022-04-06
- 0.5.1 — 2021-04-21
- 0.5.0 — 2021-04-21
- 0.4.3 — 2021-04-21
- 0.4.2 — 2021-04-21
- 0.4.1 — 2020-03-05
- 0.4.0 — 2019-10-09
- 0.3.0 — 2019-01-23
- 0.2.8 — 2018-12-14
- 0.2.6 — 2018-09-20
- 0.2.5 — 2018-08-01
- 0.2.4 — 2018-05-01
- 0.2.3 — 2018-05-01
- 0.2.2 — 2018-05-01
- 0.2.1 — 2018-05-01
- … 4 more at https://npm.io/package/did-uri/versions

## README

did-uri
=======

> I **no longer** work on Ara nor maintain https://github.com/AraBlocks/did-uri
> This fork is the cannonical and maintained repository for `did-uri`

Decentralized Identity (DID) URI parser and formatter.

## Abstract

In this module we provide a w3 compliant interface for parsing and serializing
[Decentralized Identity (DID)](https://w3c-ccg.github.io/did-spec/) URIs
as specified by [Decentralized
Identifiers](https://w3c-ccg.github.io/did-spec/#decentralized-identifiers-dids)
specification. This module provides an interface similar to that of the
`url` module in the Node standard library.

## Installation

```sh
$ npm install did-uri
```

## Example Usage

```js
const did = require('did-uri')
const spec = did.parse('did:ara:68656c6c6f/music?key=mk706c6179206d65')
console.log(spec)
```

outputs:

```js
{ reference: 'did:ara:68656c6c6f/music?key=mk706c6179206d65',
  did: 'did:ara:68656c6c6f',
  method: 'ara',
  identifier: '68656c6c6f',
  path: '/music',
  fragment: '',
  query: 'key=mk706c6179206d65',
  param: '' }
```

## API

### `parsed = did.parse(uri)`

Parses a given DID uri and returns an object similar to a `DID`
instance.

### `formated = did.format(obj)`

Formats a given DID URI or object into a normalized formatted URI.

### `did = new DID(uri [,base])`

Parses and creates a new `DID` instance.

#### `did.reference`

A reference to the `uri` that was parsed as input.

#### `did.did`

The component of the URI containing the protocol, method, and
identifier in the form of `did:method:identifier`.

#### `did.method`

The `method` component of the URI.

#### `did.identifier`

The `identifier` component of the URI.

#### `did.param`

The `param` (;) component of the URI.

#### `did.path`

The `path` component of the URI.

#### `did.fragment`

The `fragment` (#) component of the URI.

#### `did.query`

The `query` (?) component of the URI.

#### `did.parameters`

The `param` string component of the URI parsed into an object.

#### `did.queryParameters`

The `query` string component of the URI parsed into an object.

#### `did.fragmentParameters`

The `fragment` string component of the URI parsed into an object.

## See Also

* [Decentralized Identity Spec](https://github.com/w3c-ccg/did-spec)
* [Universal Resolver](https://github.com/decentralized-identity/universal-resolver)
* [did-universal-resolver-driver](https://github.com/littlstar/did-universal-resolver-driver)
* [did-universal-resolver-resolution](https://github.com/littlstar/did-universal-resolver-resolution)


## License

MIT

---
_Source: https://npm.io/package/did-uri · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
