doipjs/docs/quickstart.md

48 lines
923 B
Markdown
Raw Normal View History

2020-11-05 09:34:46 -07:00
# Quick start
## Installation
2020-11-05 19:39:36 -07:00
Install using **yarn**:
2020-11-05 09:34:46 -07:00
```bash
yarn add doipjs
```
Install using **NPM**:
```bash
npm install --save doipjs
```
## Usage (Node.js)
Basic example:
```javascript
const doip = require('doip')
const verifyIdentity = async (url, fp) => {
console.log(await doip.verify(url, fp))
}
verifyIdentity('dns:doip.rocks', '9f0048ac0b23301e1f77e994909f6bd6f80f485d')
```
2020-11-05 19:39:36 -07:00
This snippet works en will verify the [doip.rocks](https://doip.rocks) domain as
2020-11-05 09:34:46 -07:00
linked to Yarmo's cryptographic key using the [dns](serviceproviders/dns.md)
service provider.
## Usage (browser)
2020-11-05 19:39:36 -07:00
The same code as above, but for the browser:
2020-11-05 09:34:46 -07:00
```html
<script src="https://cdn.jsdelivr.net/npm/keyoxide@0.3.0/dist/doip.min.js"></script>
```
```javascript
const verifyIdentity = async (url, fp) => {
console.log(await doip.verify(url, fp))
}
verifyIdentity('dns:doip.rocks', '9f0048ac0b23301e1f77e994909f6bd6f80f485d')
```