# https-did-resolver

> Resolve DID documents from an https domain

Latest version **1.0.0** (published 2019-08-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install https-did-resolver
pnpm add https-did-resolver
yarn add https-did-resolver
bun add https-did-resolver
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-08-19 |
| First published | 2018-10-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 18.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mike Xu |
| Maintainers | aldigjo, localredhead, mike.xu, pelleb, rmw2, simonas-notcat |

## Links

- npm: https://www.npmjs.com/package/https-did-resolver
- npm.io page: https://npm.io/package/https-did-resolver

## Dependencies (2)

- [did-resolver](https://npm.io/package/did-resolver.md) 1.0.0
- [xmlhttprequest](https://npm.io/package/xmlhttprequest.md) ^1.8.0

## Recent versions

- 1.0.0 (latest) — 2019-08-19
- 0.1.0-alpha1 (alpha) — 2019-01-11
- 0.1.0 — 2019-01-14
- 0.0.3 — 2018-10-16
- 0.0.2 — 2018-10-10
- 0.0.1 — 2018-10-08

## README

---
title: "HTTPS DID Resolver"
index: 0
category: "https-did-resolver"
type: "reference"
source: "https://github.com/uport-project/https-did-resolver/blob/develop/README.md"
---

# HTTPS DID Resolver

This library is intended to use domains accessed through https as [Decentralized Identifiers](https://w3c-ccg.github.io/did-spec/#decentralized-identifiers-dids) and retrieve an associated [DID Document](https://w3c-ccg.github.io/did-spec/#did-documents)

It supports the proposed [Decentralized Identifiers](https://w3c-ccg.github.io/did-spec/) spec from the [W3C Credentials Community Group](https://w3c-ccg.github.io).

It requires the `did-resolver` library, which is the primary interface for resolving DIDs.

## DID method

To encode a DID for an HTTPS domain, simply prepend `did:https:` to domain name.

eg: `https://example.com -> did:https:example.com`

## DID Document

The DID resolver takes the domain and forms a [well-known URI](https://tools.ietf.org/html/rfc5785) to access the DID Document.

For a did `did:https:example.com`, the resolver will attempt to access the document at `https://example.com/.well-known/did.json`

A minimal DID Document might contain the following information:

```js
{
  '@context': 'https://w3id.org/did/v1',
  id: 'did:https:example.com',
  publicKey: [{
       id: 'did:https:example.com#owner',
       type: 'Secp256k1VerificationKey2018',
       owner: 'did:https:example.com',
       ethereumAddress: '0xb9c5714089478a327f09197987f16f9e5d936e8a'}],
  authentication: [{
       type: 'Secp256k1SignatureAuthentication2018',
       publicKey: 'did:https:example.com#owner'}]
}
```

Note this uses the `Secp256k1VerificationKey2018` type and an `ethereumAddress` instead of a `publicKeyHex`, meaning that this DID is owned by an entity that controls the private key associated with that address.

## Resolving a DID document

The resolver presents a simple `resolver()` function that returns a ES6 Promise returning the DID document.

```js
import { Resolver } from 'did-resolver'
import getResolver from 'https-did-resolver'

const httpsResolver = getResolver()
const didResolver = new Resolver(httpsResolver)
didResolver.resolve('did:https:example.com').then(doc => console.log)

// You can also use ES7 async/await syntax
const doc = await didResolver.resolve('did:https:example.com')
```

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