Skip to content

Commit

Permalink
feat: rename scope (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
cavacado authored Nov 21, 2023
1 parent 13d4c0c commit ccc34c6
Show file tree
Hide file tree
Showing 37 changed files with 1,396 additions and 894 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This module does not provide the following functionality:
## Installation

```bash
npm i @govtechsg/oa-verify
npm i @tradetrust-tt/tt-verify
```

---
Expand Down Expand Up @@ -83,7 +83,7 @@ To perform verification check on the document:

```ts
// index.ts
import { isValid, verify } from "@govtechsg/oa-verify";
import { isValid, verify } from "@tradetrust-tt/tt-verify";
import * as document from "./document.json";

const fragments = await verify(document as any);
Expand All @@ -105,7 +105,7 @@ You can build your own verify method or your own verifiers:

```ts
// creating your own verify using default exported verifiers
import { verificationBuilder, openAttestationVerifiers } from "@govtechsg/oa-verify";
import { verificationBuilder, openAttestationVerifiers } from "@tradetrust-tt/tt-verify";

const verify1 = verificationBuilder(openAttestationVerifiers, { network: "goerli" }); // this verify is equivalent to the one exported by the library
// this verify is equivalent to the one exported by the library
Expand All @@ -116,7 +116,7 @@ const verify2 = verificationBuilder([openAttestationVerifiers[0], openAttestatio

```ts
// creating your own verify using custom verifier
import { verificationBuilder, openAttestationVerifiers, Verifier } from "@govtechsg/oa-verify";
import { verificationBuilder, openAttestationVerifiers, Verifier } from "@tradetrust-tt/tt-verify";
const customVerifier: Verifier<any> = {
skip: () => {
// return a SkippedVerificationFragment if the verifier should be skipped or throw an error if it should always run
Expand Down Expand Up @@ -150,7 +150,7 @@ The function also allows a list of types to check for as a second parameter.

```ts
// index.ts
import { isValid, openAttestationVerifiers, verificationBuilder } from "@govtechsg/oa-verify";
import { isValid, openAttestationVerifiers, verificationBuilder } from "@tradetrust-tt/tt-verify";
import * as document from "./document.json";

const verify = verificationBuilder(openAttestationVerifiers, {
Expand All @@ -176,7 +176,7 @@ The `verify` function provides an option to listen to individual verification me

```ts
// index.ts
import { isValid, openAttestationVerifiers, verificationBuilder } from "@govtechsg/oa-verify";
import { isValid, openAttestationVerifiers, verificationBuilder } from "@tradetrust-tt/tt-verify";
import * as document from "./document.json";

const verify = verificationBuilder(openAttestationVerifiers, {
Expand Down Expand Up @@ -217,8 +217,8 @@ This is where `skip` and `test` methods come into play. We will use the `test` m

```ts
// index.ts
import { verificationBuilder, openAttestationVerifiers, Verifier, isValid } from "@govtechsg/oa-verify";
import { getData } from "@govtechsg/open-attestation";
import { verificationBuilder, openAttestationVerifiers, Verifier, isValid } from "@tradetrust-tt/tt-verify";
import { getData } from "@tradetrust-tt/tradetrust";
import * as document from "./document.json";

const customVerifier: Verifier<any> = {
Expand Down Expand Up @@ -246,8 +246,8 @@ Once we have decided `when` the verification method run, it's time to write the

```ts
// index.ts
import { verificationBuilder, openAttestationVerifiers, Verifier, isValid } from "@govtechsg/oa-verify";
import { getData } from "@govtechsg/open-attestation";
import { verificationBuilder, openAttestationVerifiers, Verifier, isValid } from "@tradetrust-tt/tt-verify";
import { getData } from "@tradetrust-tt/tradetrust";
import * as document from "./document.json";

const customVerifier: Verifier<any> = {
Expand Down Expand Up @@ -290,8 +290,8 @@ Extending from what have been mentioned in [Custom Verification](#custom-verific

```ts
// index.ts
import { verificationBuilder, openAttestationVerifiers, Verifier, isValid } from "@govtechsg/oa-verify";
import { getData } from "@govtechsg/open-attestation";
import { verificationBuilder, openAttestationVerifiers, Verifier, isValid } from "@tradetrust-tt/tt-verify";
import { getData } from "@tradetrust-tt/tradetrust";
import document from "./document.json";

// our custom verifier will be valid only if the document version is not https://schema.openattestation.com/2.0/schema.json
Expand Down Expand Up @@ -403,7 +403,7 @@ const verify = verificationBuilder(openAttestationVerifiers, { network: "goerli"
`oa-verify` exposes a method, called `createResolver` that allows you to easily create custom resolvers, to resolve DIDs:

```ts
import { createResolver, verificationBuilder, openAttestationVerifiers } from "@govtechsg/oa-verify";
import { createResolver, verificationBuilder, openAttestationVerifiers } from "@tradetrust-tt/tt-verify";

const resolver = createResolver({
networks: [{ name: "my-network", rpcUrl: "https://my-private-chain/besu", registry: "0xaE5a9b9..." }],
Expand Down Expand Up @@ -435,7 +435,7 @@ It requires a set of options:
The most basic way to use:

```ts
import { utils } from "@govtechsg/oa-verify";
import { utils } from "@tradetrust-tt/tt-verify";
const provider = utils.generateProvider();
// This will generate an infura provider using the default values.
```
Expand All @@ -450,15 +450,15 @@ PROVIDER_ENDPOINT_URL = "http://jsonrpc.com";
PROVIDER_API_KEY = "ajdh1j23";

// provider file
import { utils } from "@govtechsg/oa-verify";
import { utils } from "@tradetrust-tt/tt-verify";
const provider = utils.generateProvider();
// This will use the environment variables declared in the files automatically.
```

Alternate way 2 (passing values in as parameters):

```ts
import { utils } from "@govtechsg/oa-verify";
import { utils } from "@tradetrust-tt/tt-verify";
const providerOptions = {
network: "goerli",
providerType: "infura",
Expand Down Expand Up @@ -491,7 +491,7 @@ Let's see how to use it
### Example

```ts
import { utils } from "@govtechsg/oa-verify";
import { utils } from "@tradetrust-tt/tt-verify";
const fragments = verify(documentValidWithCertificateStore, { network: "goerli" });
// return the correct fragment, correctly typed
const fragment = utils.getOpenAttestationEthereumTokenRegistryStatusFragment(fragments);
Expand Down
Loading

0 comments on commit ccc34c6

Please sign in to comment.