Type parameters
Hierarchy
- BaseItem<DigitalSignItemData>
-
ItemRef<DigitalSign>
- DigitalSign
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly data
Values of object’s fields.
Readonly fields
Description of the object’s fields.
Readonly id
ID of the URL’s target.
Readonly namespace
Namespace of the URL target (the code of the workspace that the app belongs to).
Methods
confirm
-
Confirm that a digital signature certificate has been issued.
Parameters
-
secret: string
The password sent by the provider. Used to confirm that the certificate for the request has been issued. The method sends the password obtained by the user to the CSP that issued the certificate. The provider checks whether the password is correct. In the example, we send a password that is stored in the context in the
password
field.// Get the request const lastRequest = await System.signs.digitalSigns.getLastRequest(); // Extract the password from the context const userPassword = Context.data. password; // Send the password await lastRequest.confirm(userPassword);
Returns Promise<boolean>
-
fetch
-
Request complete data of a reference object.
Returns Promise<DigitalSign>
getIdentification
-
Gets the identification type.
The method returns a user identification type for digital signature certificate issuing. The example shows how you can define which actions will be executed based on the identification type used. First, let’s can get the most recent signature with the DigitalSigns.getLastRequest method. Now we need to determine what has to be done next: no action is required when authorizing with ESIA, but if a password is used for authorization, the password received from the provider needs to be entered.
const lastDigitalSign = await System.signs.digitalSigns. getLastRequest(); if (lastDigitalSign.getIdentification() === DigitalSignIdentificationType.ESIA) { // When authorizing with ESIA, no action is required return; return; } if (lastDigitalSign. getIdentification() === DigitalSignIdentificationType.Secret) { // When authorizing with a password, we need to request it await lastDigitalSign .getSecret(); // Displaying a window to enter the password // This function is used as an example // You can use any widget you prefer here this.showConfirmWindow(); }
Returns DigitalSignIdentificationType
normalize
-
Delete duplicate data in arrays.
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents). For example, you can call this method after bulk editing data within an object.
const app1 = await Context.data.app1.fetch(); const app2 = await Context.data.app2 .fetch(); app1.data.executors.push(app2.data.executors); app1.normalize(); // Now we need to go over the elements in the new array app1.data.executors .forEach( ... );
Returns void
receiveSecret
-
Gets a password for personal identification of a user within a certificate issuing request.
The method requests a password for the user from the provider. The provider then sends the password to the user using the contact information specified in the certificate request. The way the data is sent depends on the CSP and its settings. In the example below, we get the most recent certificate issuing request and get the password for it.
// Get the most recent request const lastRequest = await System.signs.digitalSigns. getLastRequest(); // Get the password for the request await lastRequest. receiveSecret();
Returns Promise<void>
setAlias
-
The method sets a name of a digital signature certificate.
The method is used to set a user-friendly name for the user certificate. In the example we replaced a standard name of a digital signature certificate
to a more user-firnely one, with an ID stored in the context://Get digital signature ID from the context const digitalSignId = Context.data.digitalSignId; if (!digitalSignId) { throw new Error( 'Digital signature ID not found'); } const digitalSign = await System.signs .digitalSigns.search().where(q => q.__id.eq(digitalSign)).first(); if (!digitalSign) { throw new Error('Digital signature not found'); } await digitalSign.setAlias('Jane Kelly's certificate');
Parameters
-
alias: string
Custom certificate name.
Returns Promise<void>
-
setPublicKey
-
Sets a public key for a certificate.
The public key contains public information about the signature obtained from the provider. It needs to be specified using the ASN.1 DER encoding. It is stored in the system for stamping documents and getting information about the organization that issued the document. The example shows how to set a public key for a digital signature using its ID stored in the context:
// Extract the ID of the signature from the context const digitalSignId = Context.data.digitalSignId; if (!digitalSignId) { throw new Error('Signature ID not found'); } const digitalSign = await System.signs.digitalSigns.search().where(q => q.__id.eq(digitalSign)). first(); if (!digitalSign) { throw new Error('Digital signature not found'); } // Get the body of the digital signature from the provider // The `getCertDataFromExternalProvider` function is added as an example const certData = await getCertDataFromExternalProvider(); // Set the public key for the signature await digitalSign.setPublicKey(certData);
Parameters
-
cert: ArrayBuffer
Digital signature public key in the ASN.1 DER encoding.
Returns Promise<void>
-
setStatus
-
The method changes the status of certificate issuing request.
The method is used to change a request’s status when a signature is issued or when signing is canceled. Statuses show which stage in the issuing process the signature is currently going through. The list of statuses is available in the DigitalSignRequestStatus interface. In the example, we change the status of a request for a signature whose ID is stored in the context:
// Extract the signature's id from the context const digitalSignId = Context.data.digitalSignId; if (!digitalSignId) { throw new Error('Signature ID not found'); } const digitalSign = await System.signs.digitalSigns.search().where(q => q.__id.eq(digitalSign)). first(); if (!digitalSign) { throw new Error('Digital signature not found'); } await digitalSign.setStatus(DigitalSignRequestStatus.Approved);
Parameters
-
status: DigitalSignRequestStatus
New status of the request.
Returns Promise<void>
-
Digital signature certificate
Certificates are issued using integrations with different providers that issue digital signature certificates and allow signing user data.