Overview
The Liccium API facilitates the declaration of metadata using cryptographic methods. This section provides an overview of key processes required for making API calls, generating unique content identifiers (CID), and ensuring secure and verifiable declarations.
Metadata collection
To make a proper API call, a structured metadata object must be included in the HTTP request body.
The metadata object contains essential information required for a declaration, including internal identifiers such as declarerId, isccCode, declarationId, and cid. It also includes cryptographic signatures for validation, namely signature and tsaSignature. The declarationMetadata section stores publicMetadata.
This structure ensures that each declaration is complete, verifiable, and secure.
Example Request Body Structure
Code
Core Properties for Declaration
To perform a valid declaration, several key parameters must be generated and included in the request. This includes computing the CID, which is a hash of the metadata, creating a cryptographic signature using a private key, and constructing a unique declaration ID. These elements ensure that each declaration is uniquely identifiable, verifiable, and compliant with the API's security requirements.
Code
CID Calculation
A unique Content Identifier (CID) is generated using cryptographic hashing of the metadata object. The CID serves as a unique, deterministic, verifiable fingerprint of the declaration metadata, ensuring its data integrity. It is created by serializing the metadata, computing a SHA-256 hash, and encoding it using a multihash format. This process requires the installation of multihashes and crypto modules.
Code
Setup of .well-known/did.json
If you are using an X.509 certificate for authentication of your declarations, you must set up a .well-known/did.json file on your domain to enable verification of your digital signatures. This file associates your domain with a Decentralized Identifier (DID) and provides the necessary cryptographic keys for signature validation.
To make digital signatures verifiable, the domain used for your did.well-known/did.json file. See Setup .well-known/did.json for step-by-step instructions.
Certificate Signature Creation
To ensure the declaration is verifiable, all metadata must be signed using a private key, which generates a cryptographic signature proving its authenticity. The x.509 certificate provides attribution, linking the signature to a verified identity and enabling trust in the declaration.
Code
TSA Signature Creation
To ensure the integrity and authenticity of the metadata at a specific point in time, a trusted timestamp must be applied to the metadata signature. This process, known as Timestamp Authority (TSA) confirmation, provides cryptographic proof that the data existed before a given time. A TSA service, such as FreeTSA, can be used to generate a timestamp, which is then included in the declaration for verification purposes.
Code
The resulting response.tsr file contains a cryptographic timestamp proving the metadata's existence at a specific time. This file serves as the tsaSignature, which must be included in the declaration object to ensure its integrity and enable verifiable time-based validation. See TSA Signature for full details.
Next Steps
- Setup .well-known/did.json for DID-based verification
- Certificate Signature for signing metadata
- TSA Signature for timestamping
- Declaration API for making your first declaration