> For the complete documentation index, see [llms.txt](https://docs-v1.archipels.io/technical-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v1.archipels.io/technical-documentation/integration-guide/verify.md).

# Verify

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td>Verify a general proof</td><td></td><td><a href="/pages/gXyOH4MvqQddGlk8efip#1-verify-general-proof">/pages/gXyOH4MvqQddGlk8efip#1-verify-general-proof</a></td></tr><tr><td></td><td>Verify a paylsip invoice</td><td></td><td><a href="/pages/gXyOH4MvqQddGlk8efip#verify-a-payslip-invoice">/pages/gXyOH4MvqQddGlk8efip#verify-a-payslip-invoice</a></td></tr><tr><td></td><td>Verify a proof of residency invoice</td><td></td><td><a href="/pages/gXyOH4MvqQddGlk8efip#verify-a-proof-of-residence-invoice">/pages/gXyOH4MvqQddGlk8efip#verify-a-proof-of-residence-invoice</a></td></tr></tbody></table>

## **VERIFY A GENERAL PROOF**

### **a) Configure your environment**

#### **i. Fetch the SDK image on Docker**

If you want to use the SDK as an API, you can fetch the Docker Image using the following commands to authenticate to our registry :

```c
docker login -u <yourUsername> -p <yourDeployToken> registry.gitlab.com
```

The credentials `<yourUsername>` and `<yourDeployToken>` will sent by Archipels on demand.

#### **ii. Set up an the environment to authenticate to our registry**

In an .env file or directly in your run environment, you must fix the following vars in order to interact with the Trust Registry.

* `TRUST_REGISTRY_URL`: url of the Trust Registry API,<https://api.archipels.io/sandbox/trust-registry/v1/> for the sandbox environment or<https://api.archipels.io/trust-registry/v1/> for the prod environment
* `TRUST_REGISTRY_API_KEY`: API key to access the Trust Registry API

Now you can run the API in a container with (if using a .env file):

```c
docker run --env-file .env registry.gitlab.com/archipels-managed/trust-registry-sdk/api:<version>
```

The version will be communicated when giving your `TRUST_REGISTRY_API_KEY`

### **b) Verify a proof**

When you want to verify data with Archipels , you need to provide at least:

* a `schema_id`
* some `metadata` and / or a `datahash`

The response will contain an array of all (limited to 4) proofs compatible with the `data` and the matching criteria defined in the proof schema.

Let say you want to verify data from presumed schema of `"schema_id": "0aaaaa3b"`. The schema is built like that :

```json
{
  "id": "0aaaaa3b",
  "name": "Example",
  "version": "0.1.0",
  "hash_algorithm": "SHA256",
  "tree_height": 2,
  "description": "Example of proof schema",
  "owner": null,
  "namespace": "archipels.io",
  "inputs": [
    "input_1",
    "input_2",
    "input_3",
    null
  ],
  "input_definitions": {
    "input_1": {
      "description": "Description of input_1",
      "standardization_function": "<standardization_function>"
    },
    "input_2": {
      "description": "Description of input_2",
      "standardization_function": "<standardization_function>"
    },
    "input_3": {
      "description": "Description of input_3",
      "standardization_function": "<standardization_function>"
    }
  },
  "metadatum_definitions": {
    "input_1": {
      "id": "i1",
      "description": "Description of input_1",
      "mandatory": true,
      "publication_flag": "searchable"
    },
    "input_2": {
      "id": "i2",
      "description": "Description input_2",
      "mandatory": true,
      "publication_flag": "searchable"
    },
    "input_3": {
      "id": "i3",
      "description": "Description of input_3",
      "mandatory": true,
      "publication_flag": "public"
    }
  },
  "matching_conditions": {
    "and": [
      "input_1",
      "input_2"
    ]
  }
}
```

According to the `"inputs"`, the mandatory `"field"` and the `"matching conditions"`, the inputs you need to verify data are `"input_1"` and `"input_2"`.

So the JSON related to the schema you need to compose is constituted from :

```json
{
"schema_id" : "0aaaaa3b",
"data": {
	"input_1" : "<input_1>",
	"input_2" : "<input_2>"
	}
}
```

Here is an example of verification for data of the presumed schema **digitalDocument** of `"schema_id": "c42e2516"`. The proof schema is described in the part \*\*\*\*\*\*\*\*[*1. Certify a. 2. a. i. Presentation of the digitalDocument schema*](https://www.notion.so/a-SDK-API-16657e86376d4368874c5be64f57a12d)*.*

The JSON corresponding to the schema

```json
{
"schema_id": "c42e2516",
	"data": {
	"sha256": "0x298d499999f5018b267b703990d8974e54505c69aa16e697a2026205abf3fc85"
	}
}
```

The command for the verification is :

```c
POST /proofs/verify -H 'Content-Type: application/json' --data '{ "schema_id": "c42e2516", "data": { "sha256": "0x298d499999f5018b267b703990d8974e54505c69aa16e697a2026205abf3fc85"}}'
Host : "<yourLocalApiInstanceUrl>"
```

The response is a Code 200, here is the response to above the verification.

```json
{
  "proofs": [
    {
      "id": "f9312476003c3bd51a2faefe128ef9affa64ed1e6acd3e35f1d5529651af1e05",
      "commitment": "4eec9aa957ccb0ad3245e04fc61692de43a9d1c02f7b1dabdd7e46466cdae046",
      "commitment_details": {
        "schema_id": "c42e2516",
        "data_hash": "f4303f4da60deebbca059dbda307159c8c6d5d798d8196a2e0a406f09eab2d19",
        "nullifier": "ea3fa1672a240f69a0a0240be9c161f8631d2c5b2a2f9829d68329047bff7051",
        "issuer_id": "17e28cbbde064617391bdac3282c2c50b33f9baba8bb509d60aca557500ab90c",
        "signature": "7e8d405c446a1f982a5b6ebd2f130cc9b35e2675ec79815a69c13c02e327d0132824abc1c944eb4534fa96b0a6653bd1d1ef9a701c49b70ade2004127c458e0e"
      },
      "anchor_id": "0000000000000000000000000000000000000000000000000000000000000001",
      "accumulator_id": 63793,
      "status": "registered",
      "public_metadata": {
        "dateCreated": {
          "value": "2022-12-24T23:59:59",
          "inclusion_proof": [
            "e0f149baa1db0413137dd49ed2ebb4e99086e74fac4d477aedd797f0e594addf",
            "5361724dc6cf58aceba888cd873949d323d30eb7e6a109ddc5b1449c55f4c64e",
            "5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
          ],
          "publication_flag": "public"
        },
        "expires": {
          "value": "2023-12-24T23:59:59",
          "inclusion_proof": [
            "e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
            "b2c111f81a0386a62f69cdcee52f782b0720a5a6729148574c3af972ba361111",
            "5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
          ],
          "publication_flag": "public"
        },
        "creator": {
          "value": "ARCHIPELS",
          "inclusion_proof": [
            "b20d7deaebe7baf78f625ed7b459c99e7ac4721150a97aca327f3ab4af71894d",
            "b2c111f81a0386a62f69cdcee52f782b0720a5a6729148574c3af972ba361111",
            "5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
          ],
          "publication_flag": "public"
        },
        "category": {
          "value": "PAYSLIP",
          "inclusion_proof": [
            "50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c",
            "2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
            "f335f8ee2d316e458fc56228318b1d0034580cca9c5447dc3e8f49ce4ec9b1f5"
          ],
          "publication_flag": "public"
        },
        "description": {
          "value": "example",
          "inclusion_proof": [
            "76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
            "2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
            "f335f8ee2d316e458fc56228318b1d0034580cca9c5447dc3e8f49ce4ec9b1f5"
          ],
          "publication_flag": "public"
        }
      },
      "queried_metadata": {
        "sha256": {
          "value": "298d499999f5018b267b703990d8974e54505c69aa16e697a2026205abf3fc85",
          "inclusion_proof": [
            "51a4fa9b4a39792017db0fe1fa75316741815498106bc515025a78c528a81601",
            "5361724dc6cf58aceba888cd873949d323d30eb7e6a109ddc5b1449c55f4c64e",
            "5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
          ],
          "publication_flag": "searchable"
        }
      }
    }
  ]
}
```

If the verification doesn’t work, you’ll get a Code 404

## **VERIFY A PAYSLIP INVOICE**

### a) How to verify a payslip invoice ?

To verify a payslip you only need few things

* The URL of our API endpoint :

  `https://api.archipels.io/verify-api/v1/verify/digital-document?category=payslip&sha256=<hash>`

  There is the call you need to make :&#x20;

```c
POST <https://api.archipels.io/verify-api/v1/verify/digital-document?category=payslip&sha256=><hash>
```

&#x20;      It’s possible to verify singular payslip on the web page [`https://verify-digital-document.archipels.io/`](https://verify-digital-document.archipels.io/). You just have to drop it !

* Your `X-Archipels-Api-Key` : Archipels will provide it once agreed to start your tests or when you buy a license. You cannot verify anything without this key.
* The document you want to verify needs to be hashed with a SHA256 algorithm. Here are the command you need to obtain a `<document_hash>` :&#x20;

```c
$ shasum -a 256 <pathToFile>/<nameFile>.<extensionFile>
```

&#x20;      or

```c
$ openssl dgst -sha256 /<pathToFile>/<nameFile>.<extensionFile>
```

**WARNING** : make sure to put “0x” before the `<document_hash>` of your document to obtain the `<hash>`. So that the `<hash>="Ox"+ <document_hash>`

### **b) Verification results**

If the verification is OK, it will be returned JSON metadata about the document. For example :

```json
{
   "certified":true,
   "data":{
      "hash":"0x8d09f56285fdf9beb3c0b37677b42bb83d022e8aa6af1de1f896a81d0a397ed8",
      "timestamp":"2022-08-30T00:00:00",
      "meta":{
         "owner":"8F1CE3C639AB446BBBDA14312B187F2A",
         "category":"PAYSLIP"
      }
   },
   "proof":{
      "id":"8c1495bafa3be85550cea395053b8057994cbf3fe9841519d98981b66e62355a",
      "commitment":"43aa6b9ba34ab3d70edd921ac97d7de503a4901188b8d85dbdb8a1fdb9e78bbe",
      "commitment_details":{
         "schema_id":"c42e2516",
         "data_hash":"0225c2135fab488c0a354df3d7fee8af624a4ae7d420e895ddc19426d1ba985f",
         "nullifier":"24c390918b096af8b9ee827e59fbf55d43147d6f3cb859c03d0743a1325f5833",
         "issuer_id":"263e20ca7ee92d24e5dcca5853a7e477936a29cbc96a26f382166550ba9cfd6b",
         "signature":"6e2d18342d8b84d6a688f68f5bd1532ebe6582242ad7c526f73e0106941c6ff86561141049d5aabf48aa0bcfc934b1bde412d2622c9498561e4022d2f572360c"
      },
      "anchor_id":"0000000000000000000000000000000000000000000000000000000000000001",
      "accumulator_id":35860,
      "status":"registered",
      "public_metadata":{
         "dateCreated":{
            "value":"2022-08-30T00:00:00",
            "inclusion_proof":[
               "0da2ba7f0f48a49f8afc20f5c1dbeea400b6a14066be70ec332ba3980a542a96",
               "35ad829ac2b08ff4f367a178b170a329de038478be6e46e67a73f8a529482797",
               "12d3baa6d1cb178730ee1d978dec993d8e748919150d50f6153f7573bf401827"
            ],
            "publication_flag":"public"
         },
         "expires":{
            "value":"2025-08-30T00:00:00",
            "inclusion_proof":[
               "1740eaf0d12a44cf1da7a6a2fc4424458814fdce6fe0069591d3d9ae3da90e4e",
               "93f45318157269f138924ceb297ae47b149f01595fad6c0c2f3a37d11c5afd5d",
               "12d3baa6d1cb178730ee1d978dec993d8e748919150d50f6153f7573bf401827"
            ],
            "publication_flag":"public"
         },
         "creator":{
            "value":"8F1CE3C639AB446BBBDA14312B187F2A",
            "inclusion_proof":[
               "f9c38fc4fd332b605f3774c42601a1de78b761065f9b15c684da945944866db1",
               "93f45318157269f138924ceb297ae47b149f01595fad6c0c2f3a37d11c5afd5d",
               "12d3baa6d1cb178730ee1d978dec993d8e748919150d50f6153f7573bf401827"
            ],
            "publication_flag":"public"
         },
         "category":{
            "value":"PAYSLIP",
            "inclusion_proof":[
               "e900a1205ded300eb9a58d5d505cdecf082024747d24d4aac9109cb00181342b",
               "2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
               "f7e3b6ebb5fc5232b65644a25d17198742b6a0073a9047fa7d61b257f81c86a6"
            ],
            "publication_flag":"public"
         },
         "description":{
            "value":"Bulletin de paie",
            "inclusion_proof":[
               "76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
               "2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
               "f7e3b6ebb5fc5232b65644a25d17198742b6a0073a9047fa7d61b257f81c86a6"
            ],
            "publication_flag":"public"
         }
      },
      "queried_metadata":{
         "sha256":{
            "value":"9d09f56285fdf9beb3c0b37677b42bb83d022e8aa6af1de1f896a81d0a397ed8",
            "inclusion_proof":[
               "9f771ee5996542058e2ad5657358c553b42b27715c9f55fd9235fccce023e0ea",
               "35ad829ac2b08ff4f367a178b170a329de038478be6e46e67a73f8a529482797",
               "12d3baa6d1cb178730ee1d978dec993d8e748919150d50f6153f7573bf401827"
            ],
            "publication_flag":"searchable"
         },
         "category":{
            "value":"PAYSLIP",
            "inclusion_proof":[
               "e900a1205ded300eb9a58d5d505cdecf082024747d24d4aac9109cb00181342b",
               "2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
               "f7e3b6ebb5fc5232b65644a25d17198742b6a0073a9047fa7d61b257f81c86a6"
            ],
            "publication_flag":"public"
         }
      }
   }
}
```

If the verification is KO, it will be returned a JSON like that :

```json
{
	"message":"Couldn't find a proof verifying submitted data"
}
```

## VERIFY A PROOF OF RESIDENCE INVOICE

### a) How to verify a proof of residence invoice ?

To verify a Proof of Residence (POR) invoice you only need few things :

* The URL of our API endpoint : [`https://api.archipels.io/gateway/production/v2/doc/verify/{hash}`](https://api.archipels.io/gateway/production/v2/doc/verify/%7bhash%7d)

  There is the call you need to make :&#x20;

```c
sGET [<https://api.archipels.io/gateway/production/v2/doc/verify/>](<https://api.archipels.io/gateway/production/v2/doc/verify/>)<hash> \\
-H "X-Archipels-Api-Key:<apiKey>"
```

* Your `X-Archipels-Api-Key` : Archipels will provide it once agreed to start your tests or when you buy a license. You cannot verify anything without this key.
* The document you want to verify needs to be hashed with a SHA256 algorithm. Here are the command you need to obtain a `<document_hash>` :&#x20;

```c
$ shasum -a 256 <pathToFile>/<nameFile>.<extensionFile>
```

or

```c
$ openssl dgst -sha256 /<pathToFile>/<nameFile>.<extensionFile>
```

***WARNING*** : make sure to put “0x” before the `<document_hash>` of your document to obtain the `<hash>`.

So that the `<hash>="Ox"+ <document_hash>`

### **b) Verification results**

If the verification is OK, it will be returned JSON metadata about the document. For example :&#x20;

```json
{
    "certified": true,
    "data": {
        "hash": "9cd48178a6a4f29b2aca4ea65436882f83cc26b315c91d786b3f45ba65d45b45",
        "timestamp": "1652168899",
        "meta": {
            "documentName": "0x8dc48153a6a4f29b2aca4ea65436882f83cc26b315c91d786b3f45ba65d45b45.pdf",
            "documentType": "facture",
            "owner": "EDF_New"
        }
    }
}
```

If the verification is KO, it will be returned a JSON like that :

```json
{
    "certified": false,
    "data": {
        "hash": "9cd48153a7a4f29b2aca4ea65436882f83cc26b315c91d786b3f45ba65d45b45",
        "timestamp": "1671453445"
    }
}
```
