# @worldcertscom/verify

> Library to verify any worldcerts document

Latest version **3.1.0** (published 2021-06-10) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @worldcertscom/verify
pnpm add @worldcertscom/verify
yarn add @worldcertscom/verify
bun add @worldcertscom/verify
```

## 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 | 3.1.0 |
| Published | 2021-06-10 |
| First published | 2020-11-23 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 37.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | jtaynl, dassiorleando, reddysim |

## Links

- npm: https://www.npmjs.com/package/@worldcertscom/verify
- Repository: https://github.com/worldcerts/verify
- Homepage: https://github.com/worldcerts/verify#readme
- Issues: https://github.com/worldcerts/verify/issues
- npm.io page: https://npm.io/package/@worldcertscom/verify

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) ^4.3.1
- [runtypes](https://npm.io/package/runtypes.md) ^6.3.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [@worldcertscom/oa-verify](https://npm.io/package/@worldcertscom/oa-verify.md) ^7.4.4
- [@govtechsg/open-attestation](https://npm.io/package/@govtechsg/open-attestation.md) ^5.2.3

## Recent versions

- 3.1.0 (latest) — 2021-06-10
- 3.0.2 — 2021-03-24
- 3.0.1 — 2021-03-23
- 3.0.0 — 2021-03-23
- 2.2.1 — 2020-12-04
- 1.0.6 — 2020-12-04
- 1.0.5 — 2020-12-04
- 1.0.4 — 2020-11-30
- 1.0.2 — 2020-11-23
- 1.0.1 — 2020-11-23

## README

# @worldcertscom/verify

Library to verify any [Worldcerts](https://worldcerts.com) document. This library extends [@worldcertscom/oa-verify](https://github.com/worldcerts/oa-verify).

## Installation

```sh
npm install @worldcertscom/verify
```

## Usage

```typescript
import { documentMainnetValidWithCertificateStore } from "./test/fixtures/v2/document";
import { verify, isValid } from "@worldcertscom/verify";

const fragments = await verify(documentMainnetValidWithCertificateStore, { network: "ropsten" });
console.log(fragments); // see below
console.log(isValid(fragments)); // display true
```

```json
[
  {
    "data": true,
    "status": "VALID",
    "name": "OpenAttestationHash",
    "type": "DOCUMENT_INTEGRITY"
  },
  {
    "data": {
      "details": [
        {
          "address": "0x007d40224f6562461633ccfbaffd359ebb2fc9ba",
          "issued": true
        }
      ],
      "issuedOnAll": true
    },
    "status": "VALID",
    "name": "OpenAttestationEthereumDocumentStoreIssued",
    "type": "DOCUMENT_STATUS"
  },
  {
    "message": "Document issuers doesn't have \"tokenRegistry\" property or TOKEN_REGISTRY method",
    "name": "OpenAttestationEthereumTokenRegistryMinted",
    "status": "SKIPPED",
    "type": "DOCUMENT_STATUS"
  },
  {
    "data": {
      "details": [
        {
          "address": "0x007d40224f6562461633ccfbaffd359ebb2fc9ba",
          "revoked": false
        }
      ],
      "revokedOnAny": false
    },
    "status": "VALID",
    "name": "OpenAttestationEthereumDocumentStoreRevoked",
    "type": "DOCUMENT_STATUS"
  },
  {
    "message": "Document issuers doesn't have \"documentStore\" / \"tokenRegistry\" property or doesn't use DNS-TXT type",
    "status": "SKIPPED",
    "name": "OpenAttestationDnsTxt",
    "type": "ISSUER_IDENTITY"
  },
  {
    "data": [
      {
        "status": "VALID",
        "value": "0x007d40224f6562461633ccfbaffd359ebb2fc9ba",
        "name": "Government Technology Agency of Singapore (GovTech)",
        "displayCard": true,
        "website": "https://www.tech.gov.sg",
        "email": "info@tech.gov.sg",
        "phone": "+65 6211 2100",
        "logo": "/static/images/GOVTECH_logo.png",
        "id": "govtech-registry"
      }
    ],
    "name": "OpencertsRegistryVerifier",
    "status": "VALID",
    "type": "ISSUER_IDENTITY"
  }
]
```

## Differences with @govtechsg/oa-verify

### OpencertsRegistryVerifier

`OpencertsRegistryVerifier` is a new verifier specific to [Worldcerts](https://worldcerts.com) documents:

*   it ensures document `ISSUER_IDENTITY` and works closely with `OpenAttestationDnsTxt` verifier (see `isValid` below)
*   it returns a `VALID` fragment if at least one of the issuer is in [Worldcerts registry](https://worldcerts.com/static/registry.json)
*   it returns a `SKIPPED` fragment if none of the issuers is in the registry.

### isValid

With the addition of `OpencertsRegistryVerifier` verifier, different rules apply for `ISSUER_IDENTITY` type verifiers:

*   `ISSUER_IDENTITY` is valid if at least one issuer is in the registry, i.e. if `OpencertsRegistryVerifier` has status `VALID`
*   if `OpencertsRegistryVerifier` doesn't have `VALID` status then all issuers must have valid DNS-TXT record.

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

## License

[GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html)

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