Verification and Auditing

Verification

The verification methods provided are to check if the hash conforms to apostille standards and to ensure the integrity of the file contents.

To check if the hash is an apostille hash

import { Verifier } from 'apostille-library';

// Some hashed payload
const unknownHash;

// Returns true if it conforms to apostille format, false otherwise
console.log(Verifier.isApostille(unknownHash));

To determine if the hash is public or private apostille

import { Verifier } from 'apostille-library';

const apostilleHash;

// Returns true if public apostille, false otherwise
Verifier.isPublicApostille(apostilleHash);

// Returns true if private apostille, false otherwise
Verifier.isPrivateApostille(apostilleHash);

Public Apostille

To audit public apostille, we need the apostille hash and the file contents.

The apostille hash is found in hashedFileContent from the Using Public Apostille example.

const apostilleHash = hashedFileContent.message;
const fileContent = CryptoJS.enc.Utf8.parse('Public apostille is awesome !');

// Returns true
Verifier.verifyPublicApostille(apostilleHash, fileContent);

Private Apostille

The procedure is similar in private apostille. However, we also need the public account of the signer of the hash.

In the Coloring example, we use the apostille account to sign the payload.

const fileContent = CryptoJS.enc.Utf8.parse('A certificate for my LAMY 2000');
apostilleHttp.getCreationTransaction(apostillePublicAccount.publicAccount).then((creationTransaction) => {
    const apostilleHash = creationTransaction.message;
    Verifier.verifyPrivateApostille(apostillePublicAccount, fileContent, apostilleHash);
})
Last Updated: 11/28/2018, 6:02:21 AM