Get Started
More information

window.Asc.plugin.executeMethod ("OnEncryption", [args], callback)


Defines the method that allows encrypting the document.


This method should be used in the following way:

window.Asc.plugin.executeMethod ("OnEncryption", [obj]);
Parameter Description Type Example
obj A JSON object which can have the following values:
  • type - the type of encrypting operation (generatePassword - generates a password for the document, getPasswordByFile - sends the password when opening the document, setPasswordByFile - sets a password to the document, encryptData - encrypts changes when co-editing, decryptData - decrypts changes when co-editing),
    type: string,
    example: "encryptData";
  • password - a string value specifying the password to access the document,
    type: string,
    example: "password";
  • data - encrypted/decrypted changes,
    type: string,
    example: "{data}";
  • check - checks if the encryption/decryption operation is successful or not (used only for encryptData/decryptData types),
    type: boolean,
    example: true;
  • docinfo - an unencrypted part of the encrypted file,
    type: string,
    example: "{docinfo}";
  • hash - a string value specifying a file hash (sha256 by default),
    type: string,
    example: "sha256";
  • error - a string value specifying the error that occurs (the "" value means that the operation is successful),
    type: string,
    example: "no_build".

The method returns the undefined value.

window.Asc.plugin.executeMethod("OnEncryption", [{"type": "getPasswordByFile", "hash": "sha256", "docinfo": "{docinfo}"}]);