# @aomi/one-did-resolver

> 提供自定义标识的DID

Latest version **0.0.0-Alpha.2** (published 2022-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @aomi/one-did-resolver
pnpm add @aomi/one-did-resolver
yarn add @aomi/one-did-resolver
bun add @aomi/one-did-resolver
```

## 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.0.0-Alpha.2 |
| Published | 2022-04-14 |
| First published | 2022-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 尼古拉斯丶少 |
| Maintainers | sean-tian, happysuns |

## Links

- npm: https://www.npmjs.com/package/@aomi/one-did-resolver
- Repository: git@github.com:aomi-blockchain/one-did-resolver
- npm.io page: https://npm.io/package/@aomi/one-did-resolver

## Dependencies (4)

- [dids](https://npm.io/package/dids.md) ^2.4.3
- [varint](https://npm.io/package/varint.md) ^6.0.0
- [multibase](https://npm.io/package/multibase.md) ^4.0.6
- [did-resolver](https://npm.io/package/did-resolver.md) ^3.2.0

## Recent versions

- 0.0.0-Alpha.2 (latest) — 2022-04-14
- 0.0.0-Alpha.1 — 2022-04-14

## README

# One Did Provider

提供自定义标识的DID

### Installation
```
npm install @aomi/one-did-provider
// or
yarn add @aomi/one-did-provider
```

### Providers

#### OneEd25519Provider

基于`OneEd25519Provider`封装的DID。

原ED25519 DID 结构
```
did:key:z${base58(publicKey)}
```
One ED25519 DID 结构
```
did:one:${base64(flag)}.z${base58(publicKey)}
```

```typescript
import { OneEd25519Provider } from '@aomi/one-did-provider'
import KeyResolver from 'key-did-resolver'
import { DID } from 'dids'

const seed = new Uint8Array(...) //  32 bytes with high entropy
const provider = new OneEd25519Provider('master app',seed)
const did = new DID({ provider, resolver: KeyResolver.getResolver() })
await did.authenticate()

// log the DID
console.log(did.id)

// create JWS
const { jws, linkedBlock } = await did.createDagJWS({ hello: 'world' })

// verify JWS
await did.verifyJWS(jws)

// create JWE
const jwe = await did.createDagJWE({ very: 'secret' }, [did.id])

// decrypt JWE
const decrypted = await did.decryptDagJWE(jwe)

```

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