Getting started
This document will give you an example of a TypeScript integration of the TrustRegistry SDK to generate and verify Proofs of Residency data. We will cover the following steps:
- configuration of the SDK
- generation of a Proof by an issuer
- verification of this proof by a verifier
- revocation of the proof generated by the issuer
Initial setup
All interactions with the Trust Registry needs to be authenticated. This
authentication is made with the creation of a public-private key-pair linked to
an identity created of the Trust Registry. Also to interact with our APIs you
need to specify an authentication token that will be included in each request
made by the Trust Registry SDK to the Trust Registry API. The following steps
will show how you can use the SDK
to create a puclic-private key-pair and
register an identity based on this key-pair. These operations can also be done
with the SDK if needed.
Fetch the SDK
Fetch the CLI
$ curl -X GET -H "PRIVATE-TOKEN: <auth_token>" https://gitlab.com/api/v4/projects/28791042/releases/:tag_name
Please note that
archipels-cli-<os_build>
can bearchipels-cli-win.exe
,archipels-cli-macos
orarchipels-cli-linux
Rename the executable to
archipels-cli
.
For the moment, the CLI SDK will be sent directly to you through an email
Fetch the Typescript package
Through an
npmrc
file:
@archipels-managed:registry=https://gitlab.com/api/v4/projects/28791042/packages/npm/
//gitlab.com/api/v4/projects/28791042/packages/npm/:_authToken='<yourAuthToken>'
With npm
:
Fetch the API
Docker Image
Authenticate to our registry
docker login -u <yourUsername> -p <yourDeployToken> registry.gitlab.com
We recommend you to create an env file with the following vars. For the vars
ISSUER_ID
,PRIVATE_KEY
andALGORITHM
, you have to create an identity through the SDK
# .env
TRUST_REGISTRY_URL="https://api.archipels.io",
TRUST_REGISTRY_API_KEY="e872be7d-9f49-45f9-80f1-ae776f868754",
ISSUER_ID="518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6",
PRIVATE_KEY="UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==",
ALGORITHM="EDDSA"
Now you can run the API in a container with (if using a
.env
file):
docker run --env-file .env [options] registry.gitlab.com/archipels-managed/trust-registry-sdk/api:<version> [arguments]
If you want to use the SDK as an API, you can fetch the docker image using the following commands.
In an env file
or directly in your run environment, you have to fix the
following vars in order to interact with the Trust Registry:
TRUST_REGISTRY_URL
: url of the Trust Registry APITRUST_REGISTRY_API_KEY
: API key to access the Trust Registry APIISSUER_ID
: your ID as an issuer, if applicablePRIVATE_KEY
: private key used to sign dataALGORITHM
: signature algorithm usedLOG_LEVEL
: Log level to use for loggingPROXY_URL
: URL of the proxy serverPROXY_REQUEST_TIMEOUT_MS
: Request timeout (ms) for the proxy tunnel (default: 60)PROXY_SOCKET_TIMEOUT_MS
: Socket timeout (ms) for the proxy connection (default: 60)
Helm Chart
Coming soon
Create your public-private key-pair
$ ./archipels-cli key create
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry/',
});
const algorithm = 'EDDSA';
const response = tr.createKey(algorithm);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X GET $SDK_API_URL/keys
This operation will return this type of json:
{
"pub_key": "Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=",
"pv_key": "UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==",
"algo": "EDDSA"
}
Your private key (
pv_key
) authenticates you, you must keep it secure and not disclose it to anyone.
This operation is done without any communication with Trust Registry API.
The algorithm can be EDDSA
or ECDSA
.
Register your identity in the Trust Registry
To register your identity in the Trust Registry use this code
$ ./archipels-cli identity create \
-k <your-public-key> \
-m $(pwd)/metadata.json
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
});
const identity = {
pub_key: 'Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=',
metadata: {
name: 'Certification Company SAS',
description: 'Lorem...',
},
issuer_id: '518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
algorithm: 'EDDSA',
};
const response = await tr.createIdentity(identity);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/dids -H 'Content-Type: application/json' --data '{ "pub_key": "Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=", "metadata": { "name": "Certification Company SAS", "description": "Lorem..." }, "issuer_id": "518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6", "algorithm": "EDDSA" }'
Note that the
metadata
,issuer_id
andalgorithm
are optional inputs. If you get the errorconnect ECONNREFUSED
, check if you have theTRUST_REGISTRY_URL
set. The returnjson
will be like:
{
"pub_key": "Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=",
"metadata": {
"name": "Certification Company SAS",
"description": "Lorem..."
},
"issuer_id": "518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6",
"did_version": null,
"algorithm": "EDDSA"
}
To create your identity
, you need at least two environment variables, the
url
of the trust registry TRUST_REGISTRY_URL
, and the api key
to connect
to the registry TRUST_REGISTRY_API_KEY
. If you're using the API SDK, you'll
also need the URL where the API SDK is deployed (SDK_API_URL
).
To execute the command you need one mandatory argument the public key
, and 2
arguments optionals the metadata
, and your issuer_id
. If you ommit the
issuer_id
, it will create one for you. But if you don't provide an
issuer_id
, you need to save it from the response, since it will be used to
identify you.
Create your first proof
1. Create a schema
To create a
schema
use this code:
$ ./archipels-cli \
schema create \
$(pwd)/schema.json
# With schema.json =
{
"id": "c42e2516",
"name": "DigitalDocument",
"description": "An electronic file or document",
"version": "0.9.0",
"namespace": "archipels.io",
"hash_algorithm": "SHA256",
"matching_conditions": {
"or": [
"sha256"
]
},
"inputs": [
"sha256",
"dateCreated",
"expires",
"creator",
"category",
"description",
null,
null
],
"input_definitions": {
"sha256": {
"description": "The SHA-2 SHA256 hash of the content of the item.",
"standardization_function": "hexadecimal"
},
"dateCreated": {
"description": "The date on which the CreativeWork was created or the item was added to a DataFeed.",
"standardization_function": "formatDateTime"
},
"expires": {
"description": "Date the content expires and is no longer useful or available.",
"standardization_function": "formatDateTime"
},
"creator": {
"description": "The creator/author of this CreativeWork.",
"standardization_function": "replaceDiacritics.capitalize"
},
"category": {
"description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
"standardization_function": "digitalDocumentCategory"
},
"description": {
"description": "A description of the item.",
"standardization_function": ""
}
},
"metadatum_definitions": {
"sha256": {
"id": "i1",
"description": "The SHA-2 SHA256 hash of the content of the item.",
"mandatory": true,
"publication_flag": "searchable"
},
"dateCreated": {
"id": "i2",
"description": "The date on which the CreativeWork was created or the item was added to a DataFeed.",
"mandatory": true,
"publication_flag": "public"
},
"expires": {
"id": "i3",
"description": "Date the content expires and is no longer useful or available.",
"mandatory": true,
"publication_flag": "public"
},
"creator": {
"id": "i4",
"description": "The creator/author of this CreativeWork.",
"mandatory": true,
"publication_flag": "public"
},
"category": {
"id": "i5",
"description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
"mandatory": true,
"publication_flag": "public"
},
"description": {
"id": "i6",
"description": "A description of the item.",
"mandatory": true,
"publication_flag": "public"
}
}
}
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const proofSchema = {
id: 'c42e2516',
name: 'DigitalDocument',
description:
'An electronic file or document',
version: '0.9.0',
namespace: 'archipels.io',
hash_algorithm: 'SHA256',
matching_conditions: {
'or': [
'sha256'
]
},
inputs: [
'sha256',
'dateCreated',
'expires',
'creator',
'category',
'description',
null,
null
],
input_definitions: {
sha256: {
description: 'The SHA-2 SHA256 hash of the content of the item',
standardization_function: 'hexadecimal'
},
dateCreated: {
description: 'The date on which the CreativeWork was created or the item was added to a DataFeed.',
standardization_function: 'formatDateTime'
},
expires: {
description: 'Date the content expires and is no longer useful or available.',
standardization_function: 'formatDateTime'
},
creator: {
description: 'The creator/author of this CreativeWork.',
standardization_function: 'replaceDiacritics.capitalize'
},
category: {
description: 'A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.',
standardization_function: 'digitalDocumentCategory'
},
description: {
description: 'A description of the item.',
standardization_function: ''
}
},
metadatum_definitions: {
sha256: {
id: 'i1',
description: 'The SHA-2 SHA256 hash of the content of the item.',
mandatory: true,
publication_flag: 'searchable',
},
dateCreated: {
id: 'i2',
description: 'The date on which the CreativeWork was created or the item was added to a DataFeed.',
mandatory: true,
publication_flag: 'public',
},
expires: {
id: 'i3',
description: 'Date the content expires and is no longer useful or available.',
mandatory: true,
publication_flag: 'public',
},
creator: {
id: 'i4',
description: 'The creator/author of this CreativeWork.',
mandatory: true,
publication_flag: 'public',
},
category: {
id: 'i5',
description: 'A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.',
mandatory: true,
publication_flag: 'public',
},
description: {
id: 'i6',
description: 'A description of the item.',
mandatory: true,
publication_flag: 'public',
}
},
};
const response = await tr.createProofSchema(proofSchema);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
Create a json file (
digitalDocument.json
for example) containing the proof schema
{
"id": "c42e2516",
"name": "DigitalDocument",
"description": "An electronic file or document",
"version": "0.9.0",
"namespace": "archipels.io",
"hash_algorithm": "SHA256",
"matching_conditions": {
"or": [
"sha256"
]
},
"inputs": [
"sha256",
"dateCreated",
"expires",
"creator",
"category",
"description",
null,
null
],
"input_definitions": {
"sha256": {
"description": "The SHA-2 SHA256 hash of the content of the item.",
"standardization_function": "hexadecimal"
},
"dateCreated": {
"description": "The date on which the CreativeWork was created or the item was added to a DataFeed.",
"standardization_function": "formatDateTime"
},
"expires": {
"description": "Date the content expires and is no longer useful or available.",
"standardization_function": "formatDateTime"
},
"creator": {
"description": "The creator/author of this CreativeWork.",
"standardization_function": "replaceDiacritics.capitalize"
},
"category": {
"description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
"standardization_function": "digitalDocumentCategory"
},
"description": {
"description": "A description of the item.",
"standardization_function": ""
}
},
"metadatum_definitions": {
"sha256": {
"id": "i1",
"description": "The SHA-2 SHA256 hash of the content of the item.",
"mandatory": true,
"publication_flag": "searchable"
},
"dateCreated": {
"id": "i2",
"description": "The date on which the CreativeWork was created or the item was added to a DataFeed.",
"mandatory": true,
"publication_flag": "public"
},
"expires": {
"id": "i3",
"description": "Date the content expires and is no longer useful or available.",
"mandatory": true,
"publication_flag": "public"
},
"creator": {
"id": "i4",
"description": "The creator/author of this CreativeWork.",
"mandatory": true,
"publication_flag": "public"
},
"category": {
"id": "i5",
"description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
"mandatory": true,
"publication_flag": "public"
},
"description": {
"id": "i6",
"description": "A description of the item.",
"mandatory": true,
"publication_flag": "public"
}
}
}
$ curl -X POST $SDK_API_URL/schemas -H 'Content-Type: application/json' --data '@digitalDocument.json'
if the schema already exist you get:
{
"status": 409,
"message": "ProofSchemaExisting"
}
If you're creating a new type of proof, you have to create the schema first.
You need to add your issuer_id
to the .env
file, to be able to use the cli
commands.
2. Create a proof
To create a proof for a PDF document, you need to create a hash of the document using the following command
$ openssl dgst -sha256 salary.pdf
and you can build the
inputs
needed to generate the proof:
{
"sha256": "127bfb2fd7dbacd21ba33c1ff037d8d7e6f001fcdfa47b911c4e174ad967d125",
"dateCreated" : "January 23, 1993 12:00:00",
"expires": "December 17, 1995 03:24:00",
"creator": "Archipels",
"category": "PAYSLIP",
"description": "Salary for the month of December"
}
You can now create a proof, with the following code:
$ ./archipels-cli \
proof create \
$(pwd)/salary_inputs.json \
-s <schemaId>
--secret <your-secret>
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const data = {
category: 'PAYSLIP',
sha256: '127bfb2fd7dbacd21ba33c1ff037d8d7e6f001fcdfa47b911c4e174ad967d125',
expires: 'December 17, 1995 03:24:00',
};
const secret = `e872be7d-9f49-45f9-80f1-ae776f868754`;
const response = await tr.createProof(proofSchemaId, data, secret);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs -H 'Content-Type: application/json' --data '{ "schema_id": "c42e2516", "secret": "e872be7d-9f49-45f9-80f1-ae776f868754", "data": { "category": "PAYSLIP", "sha256": "127bfb2fd7dbacd21ba33c1ff037d8d7e6f001fcdfa47b911c4e174ad967d125", "expires": "December 17, 1995 03:24:00" }}'
The secret given is used to generate a nullifier. You can create a proof without giving a secret, but one will be returned after each creation. Please keep these secrets as they're the only data allowing you (or anybody) to nullify a proof.
Making request one after the other without a secret will trigger the creation of a proof twice without secret will generate a new ID every calls
If .env
file doesn't contain an ISSUER_ID
, or a PRIVATE_KEY
you will get a
message like this
A properly set up identity is required in order to create a proof
.
If the
ISSUER_ID
and thePRIVATE_KEY
don't match you will get a message like this
{
"status": 400,
"message": "Invalid signature"
}
If everything work you will get the
proof
as result:
{
"proof": {
"id": "704da46675e8da4d56d7325069f856bc7a63f6806785d09fbb2161cc8c3813ac",
"commitment": "569199d14ac47afabcd56a1a2166bfcc34c2bf2d3fec5bea541912ecf343291e",
"commitment_details": {
"schema_id": "c42e2516",
"data_hash": "ec15961357fcb068cb1c5b207e05f08a32072ba31ddbb4432305ba38f1f1e91d",
"nullifier": "64bfa5a2ef37609ab840ebdaf151e289a4d805bb77aa1d323a215561e11f9665",
"issuer_id": "7fba2b1b3c23a6b5c6cec6a813927d05383c656e19de30e63cedca28e582eb6d",
"signature": "6cbdf2d5a087433ea37c477617aeff023da389d7fca610e297ee2a1d6b1808feec8f42980d620e9597ec83d391c304fe6474752b0cb99201e1b18a487bcd1306"
},
"anchor_id": "0000000000000000000000000000000000000000000000000000000000000001",
"metadata": {
"sha256": {
"value": "70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f",
"inclusion_proof": [
"46cbb0c1cf27f294a391a61c5d72703a9b10e74f765cc47edeb017a0bee3da36",
"f83947cf1212f2984b87afecc33c8522966322e125f5e89a80e901212ce97ecf",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "searchable"
},
"dateCreated": {
"value": "1992-01-15T02:35:00",
"inclusion_proof": [
"0ff4a6122a83c99bb60c08ff7b8fc1a0501e1806de879a551d319e6c3015e230",
"f83947cf1212f2984b87afecc33c8522966322e125f5e89a80e901212ce97ecf",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"expires": {
"value": "1995-12-17T03:24:00",
"inclusion_proof": [
"e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
"51420fd302b6508377d82b71172fc623a0f07c3117dbd9295f21c23fbcb01756",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"creator": {
"value": "ARCHIPELS",
"inclusion_proof": [
"a00c4e0a97eecc4bed032a9ab1fec97acae3b87f624b25bd3af26d4b59af8c78",
"51420fd302b6508377d82b71172fc623a0f07c3117dbd9295f21c23fbcb01756",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"d170a152c3abd39ef42550c8319b0926d9494b47a175d7db3163ebf03c0f15a0",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"60c859917188ff260113589f10f2a2592ce969dd9f75131ce69b632e0b0e2598"
],
"publication_flag": "public"
},
"description": {
"value": "Paycheck for the month of December",
"inclusion_proof": [
"76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"60c859917188ff260113589f10f2a2592ce969dd9f75131ce69b632e0b0e2598"
],
"publication_flag": "public"
}
},
"accumulator_id": 28749,
"status": "pending"
},
"secret": "f1e58551-7807-46af-ac74-a863a4ce00b7",
"qrCodeBase64": "data:image/gif;base64,R0lGODdh0gDSAIAAAAAAAP///ywAAAAA0gDSAAAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73JwAMCoUGYgCIQB6Uw2DReRwmpQ0m4Dm1TiHahFGZvS7Fji+0iSZH0s1nFzt2U81GOXjRvZu3j/fYL8dXdkbIBiVxp+CXFsboRRX4qCdGR2mpeBk12RanqeZoB9mZ+EhByrcpakjKGRmGWpjJKnvoWRflaltriAnHcFpluScZa5Un6osnPLcMnAzXWor794kmSB1pTGjanNnYnQ0u/dt9fNsrHQ37Sn07qw3NzB0ab86cOowJr5t7PRwNUJW4b/HW8ZuGSNw+bZW+AcLmiV5EZewYVnMnUCLBaf+T6m2bYNHjvmfEzunihTBYSIjJUNpz6G0iupXOKB6kuUuNPmQn2ZDcqVFmSpe08H3sN0qhzj5LYdVceC/ntVzAiHYkBpTjUqgPFzXtlHAQUqdKMU4VWtUn2q21wpHkGrMgWJsJV9GSewzvXa16+/L9mxfw3sCEB9v9Ss6u38KLDTd+LBgy48iU7aEkMXIuOpHWSiJmupnyxpbLwj397CLzz7kW1R20MMvgO6lJ4YpdcZWsv2IfK3Gandnkv1WrvdoWKtHkPM1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CcidpnWynUsyq4HOWHluYiROIGx2nL42UhvKp3oBJr82WUDO6M890tFKkl8uqEGC2Fi+neTKI5s53l25Tq6CHwZSFQfKn5HenkHl42+2bHmhpcvCHPUeYy4JZbzh4ETSJcGuXUxW5iBqFDCqJQwi5NuWLI1e2eMSbLT2Z1HSZAoCImRGZM0vtNnuMaLiBZ3xMqxMNaUZdWqsci0QDtqFlR4Srh/qjhd1kqXoaqcezds52qF7IakaIhKhDWbuKlOlQmNZ1uj9bmfSBhlS+mx0DljSxubhdhSIMeXkEla6mlWd0mzMiqrGoOhH2uyBgqV7SpBcTusaAmkUPewtCWDmDdNb7WRCDqbU7uctsewCiuuScm0QduVPQeeIluRJeoDsSu7s0u7tWu7t4u7uau7u8u7veu7vwu8wSu8w0u8xWu8x6sABQAAOw=="
}
Verify your first proof
To verify the proof (i.e. the hash) for the pdf you need to execute the following command:
$ ./archipels-cli \
proof verify \
-s <schemaId> \
-m $(pwd)/salary_metadata.json
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const data = {
category: 'PAYSLIP',
sha256: '127bfb2fd7dbacd21ba33c1ff037d8d7e6f001fcdfa47b911c4e174ad967d125',
expires: 'December 17, 1995 03:24:00',
};
const response = await tr.verifyProof(proofSchemaId, data);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs/verify -H 'Content-Type: application/json' --data '{ "schema_id": "c42e2516", "data": { "category": "PAYSLIP", "sha256": "127bfb2fd7dbacd21ba33c1ff037d8d7e6f001fcdfa47b911c4e174ad967d125", "expires": "December 17, 1995 03:24:00" } }'
If you give a wrong
data_hash
ormetadata
you will get the following message
{
"status": 404,
"message": "Couldn't find a proof verifying submitted data"
}
If you have the good
data_hash
and / ormetadata
the cli will give you the proof associated to thisdata_hash
:
{
"proofs": [
{
"id": "bb33441bfaa9b45187e012bcceb8b7f4de780cf8d5f981b3a969491aeecc80dd",
"commitment": "26e5b3b10d076083e583222563183a4865a7adfbf80219bcac68ee3e76097e72",
"commitment_details": {
"schema_id": "c42e2516",
"data_hash": "4d640810e29ad9ea76d2f4c5ed7120e1ba77f994d2198dcd0c42c82fb4e49231",
"nullifier": "2708b7037a56c3700a606980f896ef216dcb2ca2f306e6d2474d47a46adf740b",
"issuer_id": "4ff5ce66c8ae3cdd1340ec42f21a011af0a4760e2634a3b975e22efe77137404",
"signature": "88a69d22dbb0b8e0f23d0523f97559ce1f8d2c1812c0169f5a65b4de44325830feef67acb85512e7e9f253461a10a8242c7ad45fec8279bc30bccff305acae0c"
},
"anchor_id": "0000000000000000000000000000000000000000000000000000000000000001",
"accumulator_id": 47923,
"status": "registered",
"public_metadata": {
"dateCreated": {
"value": "2022-06-17T14:45:00",
"inclusion_proof": [
"02974b4dfb1269789bb88d59fb6529e1d7589eeb676cf9d15ad0e90d7849bacb",
"1a1ecfd659dae79a85235173b07a4a842af3d8b0ade5c1588bc3d202cfd89a0b",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "public"
},
"expires": {
"value": "2022-10-17T14:45:00",
"inclusion_proof": [
"e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
"7151aa9fa41fdd3891e496d325a342ec10502e754f69a590bb959bc019f71dbb",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "public"
},
"creator": {
"value": "ARCHIPELS",
"inclusion_proof": [
"fed61971bd0eac9b1877e65e21cabd9d2c1d6cc5f1870e23c80ff36a0f599e01",
"7151aa9fa41fdd3891e496d325a342ec10502e754f69a590bb959bc019f71dbb",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "public"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"3f7b289261248017e93f04d511b366f23c5c45d4cb978c087deab798b85df9a3"
],
"publication_flag": "public"
},
"description": {
"value": "example",
"inclusion_proof": [
"76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"3f7b289261248017e93f04d511b366f23c5c45d4cb978c087deab798b85df9a3"
],
"publication_flag": "public"
}
},
"queried_metadata": {
"sha256": {
"value": "67afb3194a4f2e8a166a53cd418574fcc8fd96a0ee6ec254d316d46332f94cd0",
"inclusion_proof": [
"5dc5e63a3d3ef670863b5efd431c4e1384296654e1ab0e47001b2a160dbf10db",
"1a1ecfd659dae79a85235173b07a4a842af3d8b0ade5c1588bc3d202cfd89a0b",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "searchable"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"3f7b289261248017e93f04d511b366f23c5c45d4cb978c087deab798b85df9a3"
],
"publication_flag": "public"
}
}
},
{
"id": "47e9e0a648dd4221a9d41fb311b923373bd4cab05d9b5484308484892297507e",
"commitment": "fa7746b0bd1badff6aded9560b412aa94337d3681a204c88dae63f7754483739",
"commitment_details": {
"schema_id": "c42e2516",
"data_hash": "b201c161b43ef117c9b106160db3a60dde0d27a4d91cf95dbb2d180f308c2ff8",
"nullifier": "cd9d1eac732bd2e71fbebe011b162cf2d0e8ae131f86b4d8934d2e0bb3e28454",
"issuer_id": "4ff5ce66c8ae3cdd1340ec42f21a011af0a4760e2634a3b975e22efe77137404",
"signature": "019086ca9c5d8fcfd716fa2d52c16ba1004a1db0bda382724cea71b9f293c55a81eb7484a0e761b6a9909f32ad9b0c7e3e323aceb6b041eb50c955e10ad43f0e"
},
"anchor_id": "0000000000000000000000000000000000000000000000000000000000000001",
"accumulator_id": 18409,
"status": "registered",
"public_metadata": {
"dateCreated": {
"value": "2022-07-28T14:45:00",
"inclusion_proof": [
"e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
"31b6b12d737f3d46c28c6914461e0ddb9f43b7896302a237e2a7cfced704a0a9",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "public"
},
"expires": {
"value": "2022-07-28T14:45:00",
"inclusion_proof": [
"e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
"31b6b12d737f3d46c28c6914461e0ddb9f43b7896302a237e2a7cfced704a0a9",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "public"
},
"creator": {
"value": "ARCHIPELS",
"inclusion_proof": [
"6fa31297941ade2a1a480ba78ab5f71a6fc1236e44af31411484e949f1b1ba9c",
"31b6b12d737f3d46c28c6914461e0ddb9f43b7896302a237e2a7cfced704a0a9",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "public"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"0d531cec5a5148f5b0634c5acd7049a1361d23e11de0468cf4de72aac1b2e483"
],
"publication_flag": "public"
},
"description": {
"value": "example",
"inclusion_proof": [
"76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"0d531cec5a5148f5b0634c5acd7049a1361d23e11de0468cf4de72aac1b2e483"
],
"publication_flag": "public"
}
},
"queried_metadata": {
"sha256": {
"value": "67afb3194a4f2e8a166a53cd418574fcc8fd96a0ee6ec254d316d46332f94cd0",
"inclusion_proof": [
"6fa31297941ade2a1a480ba78ab5f71a6fc1236e44af31411484e949f1b1ba9c",
"d3d69cbbf11d2c4e551b74cd1380a3dc17fd98cb5c6c3b2bb9496ac15c3098a3",
"5850c9cc205646efcc54cc61fa278672f1febac2854e4b1b2cb91acbca7847a3"
],
"publication_flag": "searchable"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"0d531cec5a5148f5b0634c5acd7049a1361d23e11de0468cf4de72aac1b2e483"
],
"publication_flag": "public"
}
}
}
]
}
To verify a proof, you'll need a set of metadata
or a datahash
, as well as a
schema id
.
Reference
Proofs
Create Proof
$ ./archipels-cli proof create \
<pathToInputsFile> \
-s <schemaId> \
--secret <proofNullifier>
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const data = {
sha256: '70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f',
dateCreated: 'January 15, 1992 02:35:00',
expires: 'December 17, 1995 03:24:00',
creator: 'Archipels',
category: 'PAYSLIP',
description: 'Paycheck for the month of December',
};
const secret = `e872be7d-9f49-45f9-80f1-ae776f868754`;
const response = await tr.createProof(proofSchemaId, data, secret);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs -H 'Content-Type: application/json' --data '{"schema_id": "c42e2516", "secret": "e872be7d-9f49-45f9-80f1-ae776f868754", "data": { "sha256": "70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f", "dateCreated": "January 15, 1992 02:35:00", "expires": "December 17, 1995 03:24:00", "creator": "Archipels", "category": "PAYSLIP", "description": "Paycheck for the month of December" } }'
The secret given is used to generate a nullifier. You can create a proof without giving a secret, but one will be returned after each creation. Please keep these secrets as they're the only data allowing you (or anybody) to nullify a proof. You'll find a
qrCodeBase64
data in a proof creation response. It is the base64 representation of a QR code matrix that you can integrate in a webpage (for example), containing the inputs needed for the proof verification. If you specified an env variable calledFRONT_APP_URL
, the QR code will redirect you to the verification web app with a prefilled form. Else, the QR code will only prefill fields if you're already on the verification web app and reading it with the integrated QR code reader.
Whatever solution you use (SDK, API SDK or CLI), you'll need to give as a file or data object the list of input as well as the schema ID. The inputs should take the form of a JSON object / file.
The format of the response is presented in appendix. proofSchemaId
refers to
the id of the proofSchema to be used for the certification. For an address
certification we can use proofSchemaId = e674a3a
. The secret
must be a
random number generated separately and stored securely as this is required to
revoke the proof we've just created. If the certification doesn't work the sdk
will throw an error. The certification is idempotent, if you request the
creation of the same proof you will just receive the existing proof in the
response with its current status.
Verify Proof
With metadata
$ ./archipels-cli proof verify \
-s <schemaId> \
-m $(pwd)/<metadataFile>.json
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const data = {
sha256: '70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f',
dateCreated: 'January 15, 1992 02:35:00',
expires: 'December 17, 1995 03:24:00',
creator: 'Archipels',
category: 'PAYSLIP',
description: 'Paycheck for the month of December',
};
const response = await tr.verifyProof(proofSchemaId, data);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs/verify -H 'Content-Type: application/json' --data '{ "schema_id": "c42e2516", "data": { "sha256": "70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f", "dateCreated": "January 15, 1992 02:35:00", "expires": "December 17, 1995 03:24:00", "creator": Archipels, "category": "PAYSLIP", "description": "Paycheck for the month of December" }}'
With datahash
$ ./archipels-cli proof verify \
-s <schemaId> \
-d '<dataHash>'
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const dataHash =
'c24768a5afb4a84ed7825fc872eabdee1f3e108433ff5a03912bf3700a3122ee';
const response = await tr.verifyProof(proofSchemaId, dataHash);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs/verify -H 'Content-Type: application/json' --data '{ "schema_id": "c42e2516", "data_hash": "c24768a5afb4a84ed7825fc872eabdee1f3e108433ff5a03912bf3700a3122ee"}'
When you want to verify data with Archipels' Trust Services, you need to provide at least:
- a
schema_id
- some
metadata
and / or adatahash
The response will contain an array of all (limited to 4) proofs compatible with
the data
and the matching criteria defined in the proofSchema
.
proofSchemaId
refers to the id of the proofSchema to be used for the
certification. For an address we can use proofSchemaId = e674a3a
.
Revoke Proof
$ ./archipels-cli proof revoke \
-n <nullifier> \
-s <secret> \
-m <message>
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const data = {
sha256: '70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f',
dateCreated: 'January 15, 1992 02:35:00',
expires: 'December 17, 1995 03:24:00',
creator: 'Archipels',
category: 'PAYSLIP',
description: 'Paycheck for the month of December',
};
const nullifier =
'3e75a5edb692f4fad077c1f56a4d55437423d06bcb09565044b2b6f3beaa0182';
const secret = 'e872be7d-9f49-45f9-80f1-ae776f868754';
const message = 'Contract terminated';
const response = await tr.revokeProof(nullifier, secret, message);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs/revoke -H 'Content-Type: application/json' --data '{ "nullifier": "3e75a5edb692f4fad077c1f56a4d55437423d06bcb09565044b2b6f3beaa0182", "secret": "e872be7d-9f49-45f9-80f1-ae776f868754", "message": "Contract terminated" }'
The proof will then be marked as revoked in any future verification.
Generate qrCode
$ ./tr-cli proof qrcode \
<pathToInputsFile> \
-s <schemaId> \
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const proofSchemaId = `c42e2516`;
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const data = [
{
sha256: '70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f',
dateCreated: 'January 15, 1992 02:35:00',
expires: 'December 17, 1995 03:24:00',
creator: 'Archipels',
category: 'PAYSLIP',
description: 'Paycheck for the month of December',
}
];
const response = await tr.generateQrCodeProofs(proofSchemaId, data);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/proofs/qrcode -H 'Content-Type: application/json' --data '{"schema_id": "c42e2516", "data": [ { "sha256": "70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f", "dateCreated": "January 15, 1992 02:35:00", "expires": "December 17, 1995 03:24:00", "creator": "Archipels", "category": "PAYSLIP", "description": "Paycheck for the month of December" } ] }'
Proofs Schemas
Create Proof Schema
$ ./archipels-cli schema create $(pwd)/pay_slip_v1.0.0.json
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const proofSchema = {
id: 'c42e2516',
name: 'DigitalDocument',
description:
'An electronic file or document',
version: '0.9.0',
namespace: 'archipels.io',
hash_algorithm: 'SHA256',
matching_conditions: {
'or': [
'sha256'
]
},
inputs: [
'sha256',
'dateCreated',
'expires',
'creator',
'category',
'description',
null,
null
],
input_definitions: {
sha256: {
description: 'The SHA-2 SHA256 hash of the content of the item',
standardization_function: 'hexadecimal'
},
dateCreated: {
description: 'The date on which the CreativeWork was created or the item was added to a DataFeed.',
standardization_function: 'formatDateTime'
},
expires: {
description: 'Date the content expires and is no longer useful or available.',
standardization_function: 'formatDateTime'
},
creator: {
description: 'The creator/author of this CreativeWork.',
standardization_function: 'replaceDiacritics.capitalize'
},
category: {
description: 'A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.',
standardization_function: 'digitalDocumentCategory'
},
description: {
description: 'A description of the item.',
standardization_function: ''
}
},
metadatum_definitions: {
sha256: {
id: 'i1',
description: 'The SHA-2 SHA256 hash of the content of the item.',
mandatory: true,
publication_flag: 'searchable',
},
dateCreated: {
id: 'i2',
description: 'The date on which the CreativeWork was created or the item was added to a DataFeed.',
mandatory: true,
publication_flag: 'public',
},
expires: {
id: 'i3',
description: 'Date the content expires and is no longer useful or available.',
mandatory: true,
publication_flag: 'public',
},
creator: {
id: 'i4',
description: 'The creator/author of this CreativeWork.',
mandatory: true,
publication_flag: 'public',
},
category: {
id: 'i5',
description: 'A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.',
mandatory: true,
publication_flag: 'public',
},
description: {
id: 'i6',
description: 'A description of the item.',
mandatory: true,
publication_flag: 'public',
}
},
};
const response = await tr.createProofSchema(proofSchema);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/schemas -H 'Content-Type: application/json' --data '{ "id": "c42e2516", "name": "DigitalDocument", "description": "An electronic file or document", "version": "0.9.0", "namespace": "archipels.io", "hash_algorithm": "SHA256", "matching_conditions": { "or": [ "sha256" ] }, "inputs": [ "sha256", "dateCreated", "expires", "creator", "category", "description", null, null ], "input_definitions": { "sha256": { "description": "The SHA-2 SHA256 hash of the content of the item.", "standardization_function": "hexadecimal" }, "dateCreated": { "description": "The date on which the CreativeWork was created or the item was added to a DataFeed.", "standardization_function": "formatDateTime" }, "expires": { "description": "Date the content expires and is no longer useful or available.", "standardization_function": "formatDateTime" }, "creator": { "description": "The creator/author of this CreativeWork.", "standardization_function": "replaceDiacritics.capitalize" }, "category": { "description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.", "standardization_function": "digitalDocumentCategory" }, "description": { "description": "A description of the item.", "standardization_function": "" } }, "metadatum_definitions": { "sha256": { "id": "i1", "description": "The SHA-2 SHA256 hash of the content of the item.", "mandatory": true, "publication_flag": "searchable" }, "dateCreated": { "id": "i2", "description": "The date on which the CreativeWork was created or the item was added to a DataFeed.", "mandatory": true, "publication_flag": "public" }, "expires": { "id": "i3", "description": "Date the content expires and is no longer useful or available.", "mandatory": true, "publication_flag": "public" }, "creator": { "id": "i4", "description": "The creator/author of this CreativeWork.", "mandatory": true, "publication_flag": "public" }, "category": { "id": "i5", "description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.", "mandatory": true, "publication_flag": "public" }, "description": { "id": "i6", "description": "A description of the item.", "mandatory": true, "publication_flag": "public" } } } '
Get Proof Schema
$ ./archipels-cli schema get "<proofSchemaId>"
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
identity: {
issuerId:
'518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
privateKey:
'UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==',
},
});
const proofSchemaId = 'c42e2516';
const response = await tr.getProofSchema(proofSchemaId);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X GET $SDK_API_URL/schemas/c42e2516
Keys
Create keys (locally)
$ ./archipels-cli key create
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
});
const algorithm = 'EDDSA';
const response = tr.createKey(algorithm);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X GET $SDK_API_URL/keys
{
"pub_key": "Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=",
"pv_key": "UaBBJVneNEe2q967GHAroXS2tNkoYgr7ZHFjoTlEvMs172Dtq9XaHP4gN9PehiKNotZPPQYfWv9NkzgoTnbWsw==",
"algo": "EDDSA"
}
DIDs
Create DIDs
$ ./archipels-cli identity create \
-k <your-public-key> \
-m $(pwd)/metadata.json
import TrustRegistrySDK from '@archipels-managed/trust-registry-sdk';
const tr = new TrustRegistrySDK({
trustRegistryURL: 'https://api.archipels.io/trust-registry',
apiKey: '8b6a3e9a-5967-484f-8b14-aeb5420a375b',
});
const identity = {
pub_key: 'Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=',
metadata: {
name: 'Certification Company SAS',
description: 'Lorem...',
},
issuer_id: '518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6',
algorithm: 'EDDSA',
};
const response = await tr.createIdentity(identity);
$ export SDK_API_URL="<yourLocalApiInstanceUrl>"
$ curl -X POST $SDK_API_URL/dids -H 'Content-Type: application/json' --data '{ "pub_key": "Ne9g7avV2hz+IDfT3oYijaLWTz0GH1r/TZM4KE521rM=", "metadata": { "name": "Certification Company SAS", "description": "Lorem..." }, "issuer_id": "518f623212217689f0b0ab91157454847aa034f41219829abcd6ea3b898790a6", "algorithm": "EDDSA" }'
Appendix
Proof response
{
"proof": {
"id": "04d57811235f9d390354460ca8e065f920551a18691ee6dfd81599f056294d4f",
"commitment": "71a029f95e28f2772e374f2598e50282b4f4fab2dbaf98c545ed605510b0c6d2",
"commitment_details": {
"schema_id": "c42e2516",
"data_hash": "ec15961357fcb068cb1c5b207e05f08a32072ba31ddbb4432305ba38f1f1e91d",
"nullifier": "bc627bb8e0f6623bf3d2321c563f97d566bb48bcb5a60741a29060fdd73cf9c8",
"issuer_id": "7fba2b1b3c23a6b5c6cec6a813927d05383c656e19de30e63cedca28e582eb6d",
"signature": "6cbdf2d5a087433ea37c477617aeff023da389d7fca610e297ee2a1d6b1808feec8f42980d620e9597ec83d391c304fe6474752b0cb99201e1b18a487bcd1306"
},
"anchor_id": "0000000000000000000000000000000000000000000000000000000000000001",
"metadata": {
"sha256": {
"value": "70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f",
"inclusion_proof": [
"46cbb0c1cf27f294a391a61c5d72703a9b10e74f765cc47edeb017a0bee3da36",
"f83947cf1212f2984b87afecc33c8522966322e125f5e89a80e901212ce97ecf",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "searchable"
},
"dateCreated": {
"value": "1992-01-15T02:35:00",
"inclusion_proof": [
"0ff4a6122a83c99bb60c08ff7b8fc1a0501e1806de879a551d319e6c3015e230",
"f83947cf1212f2984b87afecc33c8522966322e125f5e89a80e901212ce97ecf",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"expires": {
"value": "1995-12-17T03:24:00",
"inclusion_proof": [
"e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
"51420fd302b6508377d82b71172fc623a0f07c3117dbd9295f21c23fbcb01756",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"creator": {
"value": "ARCHIPELS",
"inclusion_proof": [
"a00c4e0a97eecc4bed032a9ab1fec97acae3b87f624b25bd3af26d4b59af8c78",
"51420fd302b6508377d82b71172fc623a0f07c3117dbd9295f21c23fbcb01756",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"d170a152c3abd39ef42550c8319b0926d9494b47a175d7db3163ebf03c0f15a0",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"60c859917188ff260113589f10f2a2592ce969dd9f75131ce69b632e0b0e2598"
],
"publication_flag": "public"
},
"description": {
"value": "Paycheck for the month of December",
"inclusion_proof": [
"76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"60c859917188ff260113589f10f2a2592ce969dd9f75131ce69b632e0b0e2598"
],
"publication_flag": "public"
}
},
"accumulator_id": 1237,
"status": "pending"
},
"secret": "852a4003-e1e8-45ad-b589-3ff8d209ea11",
"qrCodeBase64": "data:image/gif;base64,R0lGODdh0gDSAIAAAAAAAP///ywAAAAA0gDSAAAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73JwAMCoUGYgCIQB6Uw2DReRwmpQ0m4Dm1TiHahFGZvS7Fji+0iSZH0s1nFzt2U81GOXjRvZu3j/fYL8dXdkbIBiVxp+CXFsboRRX4qCdGR2mpeBk12RanqeZoB9mZ+EhByrcpakjKGRmGWpjJKnvoWRflaltriAnHcFpluScZa5Un6osnPLcMnAzXWor794kmSB1pTGjanNnYnQ0u/dt9fNsrHQ37Sn07qw3NzB0ab86cOowJr5t7PRwNUJW4b/HW8ZuGSNw+bZW+AcLmiV5EZewYVnMnUCLBaf+T6m2bYNHjvmfEzunihTBYSIjJUNpz6G0iupXOKB6kuUuNPmQn2ZDcqVFmSpe08H3sN0qhzj5LYdVceC/ntVzAiHYkBpTjUqgPFzXtlHAQUqdKMU4VWtUn2q21wpHkGrMgWJsJV9GSewzvXa16+/L9mxfw3sCEB9v9Ss6u38KLDTd+LBgy48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k2yZCBpZiDJZIP+adx2nZjKDzJ1pN4plEId1qTB5PJaoCfV3ogVZdWpaZ4g4CQRaZQtlKxJpDe6FMA16Hz1CcidpnWynUsyq4HOWHluYiROIGx2nL42UhvKp3oBJr82WUDO6M890tFKkl8uqEGC2Fi+neTKI5s53l25Tq6CHwZSFQfKn5HenkHl42+2bHmhpcvCHPUeYy4JZbzh4ETSJcGuXUxW5iBqFDCqJQwi5NuWLI1e2eMSbLT2Z1HSZAoCImRGZM0vtNnuMaLiBZ3xMqxMNaUZdWqsci0QDtqFlR4Srh/qjhd1kqXoaqcezds52qF7IakaIhKhDWbuKlOlQmNZ1uj9bmfSBhlS+mx0DljSxubhdhSIMeXkEla6mlWd0mzMiqrGoOhH2uyBgqV7SpBcTusaAmkUPewtCWDmDdNb7WRCDqbU7uctsewCiuuScm0QduVPQeeIluRJeoDsSu7s0u7tWu7t4u7uau7u8u7veu7vwu8wSu8w0u8xWu8x6sABQAAOw=="
}
Explanation of Proof
attributes:
ìd
: This item is a unique identifier of the proof. It summarizes the content of the proof but not the authentication of its issuer. This attribute defines its position in the trust registry.commitment
: This is the hash that guaranties integrity of the whole proof.commitment_details
: These items are the intermediate values used to create and structure the commitment, they are sent to Archipels during the proof creation to validate integrity of the commitment.anchor_id
: This value indicates in which batch the proof will be anchored on the Blockchain.status
: When creating a proof, its status is firstpending
, then it becomesregistered
when the proof is included in the trust-registry and then it becomesincluded
when the root of the trusted registry is anchored on the blockchain and fully timestamped and made immutable.metadata
: These metadata are the values used to verify a proof. Each metadatum has avalue
which can be a hash or a standardized value of an input. It also has an inclusion proof that proves cryptographically that this value is included in theproofId
. And it has apublication_flag
which specifies how this metadata can be used during proof verification. If this flag is set toprivate
then the metadatum is only used by Archipels for consistency checks. If the flag is set topublic
then the metadatum is sent to the verifier when a verification matches this proof. If this flag is set tosearchable
then the metadatum is only used to match with a proof verification.
Example
Certification and verification: data of a pay slip
$ ./archipels-cli \
schema create \
$(pwd)/bulletin_salaire.json
where
bulletin_salaire.json
is
{
"id": "c42e2516",
"name": "DigitalDocument",
"description": "An electronic file or document",
"version": "0.9.0",
"namespace": "archipels.io",
"hash_algorithm": "SHA256",
"matching_conditions": {
"or": [
"sha256"
]
},
"inputs": [
"sha256",
"dateCreated",
"expires",
"creator",
"category",
"description",
null,
null
],
"input_definitions": {
"sha256": {
"description": "The SHA-2 SHA256 hash of the content of the item.",
"standardization_function": "hexadecimal"
},
"dateCreated": {
"description": "The date on which the CreativeWork was created or the item was added to a DataFeed.",
"standardization_function": "formatDateTime"
},
"expires": {
"description": "Date the content expires and is no longer useful or available.",
"standardization_function": "formatDateTime"
},
"creator": {
"description": "The creator/author of this CreativeWork.",
"standardization_function": "replaceDiacritics.capitalize"
},
"category": {
"description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
"standardization_function": "digitalDocumentCategory"
},
"description": {
"description": "A description of the item.",
"standardization_function": ""
}
},
"metadatum_definitions": {
"sha256": {
"id": "i1",
"description": "The SHA-2 SHA256 hash of the content of the item.",
"mandatory": true,
"publication_flag": "searchable"
},
"dateCreated": {
"id": "i2",
"description": "The date on which the CreativeWork was created or the item was added to a DataFeed.",
"mandatory": true,
"publication_flag": "public"
},
"expires": {
"id": "i3",
"description": "Date the content expires and is no longer useful or available.",
"mandatory": true,
"publication_flag": "public"
},
"creator": {
"id": "i4",
"description": "The creator/author of this CreativeWork.",
"mandatory": true,
"publication_flag": "public"
},
"category": {
"id": "i5",
"description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
"mandatory": true,
"publication_flag": "public"
},
"description": {
"id": "i6",
"description": "A description of the item.",
"mandatory": true,
"publication_flag": "public"
}
}
}
For the certification and the verification of the data of a pay slip, it's the same methodology but the schema is different.
$ ./archipels-cli \
proof create \
$(pwd)/salary_metadata_2.json \
-s c42e2516
{
"proof": {
"id": "04d57811235f9d390354460ca8e065f920551a18691ee6dfd81599f056294d4f",
"commitment": "71a029f95e28f2772e374f2598e50282b4f4fab2dbaf98c545ed605510b0c6d2",
"commitment_details": {
"schema_id": "c42e2516",
"data_hash": "ec15961357fcb068cb1c5b207e05f08a32072ba31ddbb4432305ba38f1f1e91d",
"nullifier": "bc627bb8e0f6623bf3d2321c563f97d566bb48bcb5a60741a29060fdd73cf9c8",
"issuer_id": "7fba2b1b3c23a6b5c6cec6a813927d05383c656e19de30e63cedca28e582eb6d",
"signature": "6cbdf2d5a087433ea37c477617aeff023da389d7fca610e297ee2a1d6b1808feec8f42980d620e9597ec83d391c304fe6474752b0cb99201e1b18a487bcd1306"
},
"anchor_id": "0000000000000000000000000000000000000000000000000000000000000001",
"metadata": {
"sha256": {
"value": "70f686dc827587aaa97566cbc0d1aae4f52662a4e1ab4cfc36249e46c2cbf91f",
"inclusion_proof": [
"46cbb0c1cf27f294a391a61c5d72703a9b10e74f765cc47edeb017a0bee3da36",
"f83947cf1212f2984b87afecc33c8522966322e125f5e89a80e901212ce97ecf",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "searchable"
},
"dateCreated": {
"value": "1992-01-15T02:35:00",
"inclusion_proof": [
"0ff4a6122a83c99bb60c08ff7b8fc1a0501e1806de879a551d319e6c3015e230",
"f83947cf1212f2984b87afecc33c8522966322e125f5e89a80e901212ce97ecf",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"expires": {
"value": "1995-12-17T03:24:00",
"inclusion_proof": [
"e15fc0f1e72b93eb4134fafa5a6f81f33c09fc7d95930c51e2cb5cb55f8226df",
"51420fd302b6508377d82b71172fc623a0f07c3117dbd9295f21c23fbcb01756",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"creator": {
"value": "ARCHIPELS",
"inclusion_proof": [
"a00c4e0a97eecc4bed032a9ab1fec97acae3b87f624b25bd3af26d4b59af8c78",
"51420fd302b6508377d82b71172fc623a0f07c3117dbd9295f21c23fbcb01756",
"0a7d7b1a2de7725157b75fb2a2d8e0d51d83e14540411915beddc466840adee4"
],
"publication_flag": "public"
},
"category": {
"value": "PAYSLIP",
"inclusion_proof": [
"d170a152c3abd39ef42550c8319b0926d9494b47a175d7db3163ebf03c0f15a0",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"60c859917188ff260113589f10f2a2592ce969dd9f75131ce69b632e0b0e2598"
],
"publication_flag": "public"
},
"description": {
"value": "Paycheck for the month of December",
"inclusion_proof": [
"76d74e17240f1c3a5e2dbc56210dbfd5ccb4374be9cafd61cd14aedc9e4a2670",
"2dba5dbc339e7316aea2683faf839c1b7b1ee2313db792112588118df066aa35",
"60c859917188ff260113589f10f2a2592ce969dd9f75131ce69b632e0b0e2598"
],
"publication_flag": "public"
}
},
"accumulator_id": 1237,
"status": "pending"
},
"secret": "852a4003-e1e8-45ad-b589-3ff8d209ea11",
"qrCodeBase64": "data:image/gif;base64,R0lGODdh0gDSAIAAAAAAAP///ywAAAAA0gDSAAAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73JwAMCoUGYgCIQB6Uw2DReRwmpQ0m4Dm1TiHahFGZvS7Fji+0iSZH0s1nFzt2U81GOXjRvZu3j/fYL8dXdkbIBiVxp+CXFsboRRX4qCdGR2mpeBk12RanqeZoB9mZ+EhByrcpakjKGRmGWpjJKnvoWRflaltriAnHcFpluScZa5Un6osnPLcMnAzXWor794kmSB1pTGjanNnYnQ0u/dt9fNsrHQ37Sn07qw3NzB0ab86cOowJr5t7PRwNUJW4b/HW8ZuGSNw+bZW+AcLmiV5EZewYVnMnUCLBaf+T6m2bYNHjvmfEzunihTBYSIjJUNpz6G0iupXOKB6kuUuNPmQn2ZDcqVFmSpe08H3sN0qhzj5LYdVceC/ntVzAiHYkBpTjUqgPFzXtlHAQUqdKMU4VWtUn2q21wpHkGrMgWJsJV9GSewzvXa16+/L9mxfw3sCEB9v9Ss6u38KLDTd+LBgy48i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