You can work with signatures and certificates saved in the system: get and decipher public keys of users, get the content of signatures or certificates, and so on.

Work with certificates

You can work with certificates (digital signatures) using DigitalSign. To get DigitalSign, use the DigitalSigns service to search among digital signatures saved in the system using the DigitalSigns.search method.
You can use search to get certificates using filtering by the available fields of DigitalSign.

const digitalSign = await System. signs.digitalSigns.search().where(f => f.__id.eq(Context.data.certId)). first();

Actions that can be performed with a certificate are described in DigitalSign. For example, you can set a public key for it:

const digitalSign = await System.signs.digitalSigns.search(). where(f => f.__id.eq(Context.data.certId)).first();
await digitalSign. setPublicKey(cert); 

Work with signatures

You can work with data signatures using EntitySignItem. To get signatures, use the EntitySigns service. To use the search functions, call the [[EntitySigns. search]] method.

const entitySign = await System.signs. entitySigns.search().where(f => f.__id.eq(Context.data.signId')).first();  

As a result, the data signature (EntitySignItem) will be obtained. You can perform a number of actions with it, for example, get detailed information about it, including data from the public key:

//  Search for the signature
const entitySign = await System.signs.entitySigns. search().where(f => f.__id.eq(Context.data.signId')).first(); 
if  (!entitySign) { 
    throw new Error('Signature not found'); 
} 
// Get  detailed information 
const signDetails = await entitySign.getSignDetails();  

Type aliases

SignHash

SignHash: string

A sequence of characters calculated based on the signature’s type and the app item’s data. It ensures that the signed data of an app item is not changed after signing.

SignedContent

SignedContent: string

This type stores data signed by the user:

  • If the attributes are signed, the type stores a data object in the JSON format.
  • If a file is signed, the type stores the file’s hash that can be used to identify its content in the system.
  • If a decision in the approval process is signed, the type stores information about the decision.