Skip to main content

Verify digital signature

Signature verification

Once you have some data/document signed, you can verify the digital signature in it by following the integrity verification process that automatically verifies the signatures (if any) or you can do it by your own:

import {
AuthenticityClient,
KeyClient,
KeyType,
RecordClient,
Signer,
} from '@bloock/sdk';

const keyClient = new KeyClient();
const authenticityClient = new AuthenticityClient();
const recordClient = new RecordClient();

const key = await keyClient.newLocalKey(KeyType.EcP256k);

const signedRecord = await recordClient
.fromString('Hello world')
.withSigner(new Signer(key))
.build();

const valid = await authenticityClient.verify(signedRecord);
if (valid) {
console.log('Signature was verified successfully');
}