Use methods in EntitySignItem. The method generates a file from the signed app item attributes.
It returns the values of the signed attributes as a file.
The example shows how to extract all attribute signatures of an app item:
// The signature's ID is stored in the context const signId = Context.data.signId;
if (!signId) {
thrownewError( 'Signature ID not found');
}
// Search for the signature by ID const sign = await System.signs.entitySigns.search().where(q => q.__id.eq(signId)). first();
if(!sign) {
thrownewError('Signature not found');
}
// Signature files request const awaitSigns = sign.signs.map(signData => signData.createAttributesFile());
// Wait for the requests to finish
Context.data.signFiles = awaitPromise.all(awaitSigns);
Use methods in EntitySignItem.
The method generates a file with a signature.
It is used to get a signature’s body as a file.
The example shows how to extract all file signatures of an app item:
// The signature's ID is stored in the context const signId = Context.data. signId;
if (!signId) {
thrownewError('Signature ID not found');
}
// Search for the signature by ID const sign = await System.signs. entitySigns.search().where(q => q.__id.eq(signId)).first();
if(!sign) {
thrownewError('Signature not found');
}
// Request signature files const awaitSigns = sign.signs.map(signData => signData.createSignFile());
// Wait for the requests to finish
Context.data.signFiles = awaitPromise. all(awaitSigns);
Use methods in EntitySignItem. This method returns detailed information about the signature and the public key
that was used to create it. The following information is extracted from the public key: attributes of the issuer and the owner, validity dates, and the public key’s name and serial number. The attributes are named according to RFC 2253,
however, attributes that are not among standard CertNames fields are not encoded as hex.
In the example, detailed information about a signature is extracted to save the certificate’s serial number to the process context:
// The signature’s ID is stored in the context const signId = Context.data.signId;
if (!signId) {
thrownewError('Signature ID not found');
}
// Search for the signature by ID const sign = await System.signs.entitySigns. search().where(q => q.__id.eq(signId)).first();
if(!sign) {
thrownewError('Signature not found');
}
// Extracting the most recent signature from the history const lastSign = sign.signs[0];
if (!lastSign) {
thrownewError('Signature needed to extract the data');
}
// Extract the detailed information const signDetails = await lastSign.getDetails();
// Save the serial number of the certificate to the context
Context.data.certificateId = signDetails.certSerialNumber;
Data stored in an app item’s signature
Hierarchy
Properties
Readonly __createdAt
Date and time of creation.
Readonly __createdBy
Object’s author.
Optional Readonly __deletedAt
Date and time of deletion.
Readonly __id
ID of the object.
__name
Name of the object.
Readonly __updatedAt
Date and time of change.
Readonly __updatedBy
Author of the last change.
activationLink
Link to activate the certificate.
body
Signed data.
The field stores the signature’s body in the
base24format. If a file was signed, the field stores the ID of the file’s body, not the content.cert
Public key of the digital signature in the
base24format.comment
Comment to the signature.
content
Signed data.
createdAt
Date of creation.
hash
Hash calculated for the signed content.
Hash used to determine which file version was signed.
id
ID of the signature.
lastSyncTime
Date and time of the last synchronization of the signing status with the digital signature provider.
operationStatus
Document signing operation status.
phone
Phone number specified if signing is confirmed by phone.
provider
Digital signature provider used for signing data.
sign
Content of the calculated signature.
The field stores the signature’s body in the
base64format.status
Signature status.
statusMessage
Message specifying the signature’s status.
The fields stores the comment to the current status of the signature.
tags
Links to signature tags.
type
Type of the calculated signature.
userID
ID of the user who signed the item.
validUntilAt
Date and time until which the certificate can be used to sign documents.
Methods
createAttributesFile
Use methods in EntitySignItem. The method generates a file from the signed app item attributes. It returns the values of the signed attributes as a file. The example shows how to extract all attribute signatures of an app item:
// The signature's ID is stored in the context const signId = Context.data.signId; if (!signId) { throw new Error( 'Signature ID not found'); } // Search for the signature by ID const sign = await System.signs.entitySigns.search().where(q => q.__id.eq(signId)). first(); if(!sign) { throw new Error('Signature not found'); } // Signature files request const awaitSigns = sign.signs.map(signData => signData.createAttributesFile()); // Wait for the requests to finish Context.data.signFiles = await Promise.all(awaitSigns);Returns Promise<FileItem | undefined>
File with the attributes of an app item that have been signed.
createSignFile
Use methods in EntitySignItem. The method generates a file with a signature. It is used to get a signature’s body as a file. The example shows how to extract all file signatures of an app item:
// The signature's ID is stored in the context const signId = Context.data. signId; if (!signId) { throw new Error('Signature ID not found'); } // Search for the signature by ID const sign = await System.signs. entitySigns.search().where(q => q.__id.eq(signId)).first(); if(!sign) { throw new Error('Signature not found'); } // Request signature files const awaitSigns = sign.signs.map(signData => signData.createSignFile()); // Wait for the requests to finish Context.data.signFiles = await Promise. all(awaitSigns);Returns Promise<FileItem>
File with the signature.
getDetails
Use methods in EntitySignItem. This method returns detailed information about the signature and the public key that was used to create it. The following information is extracted from the public key: attributes of the issuer and the owner, validity dates, and the public key’s name and serial number. The attributes are named according to RFC 2253, however, attributes that are not among standard CertNames fields are not encoded as hex. In the example, detailed information about a signature is extracted to save the certificate’s serial number to the process context:
// The signature’s ID is stored in the context const signId = Context.data.signId; if (!signId) { throw new Error('Signature ID not found'); } // Search for the signature by ID const sign = await System.signs.entitySigns. search().where(q => q.__id.eq(signId)).first(); if(!sign) { throw new Error('Signature not found'); } // Extracting the most recent signature from the history const lastSign = sign.signs[0]; if (!lastSign) { throw new Error('Signature needed to extract the data'); } // Extract the detailed information const signDetails = await lastSign.getDetails(); // Save the serial number of the certificate to the context Context.data.certificateId = signDetails.certSerialNumber;Returns Promise<SignDetails>
Feedback sent successfully
Thank you for your input