Page tree
Skip to end of metadata
Go to start of metadata

sign

Function

Requires the user to sign the prepared HASH value (signable data for example). Connection to a browser plugin/extension that provides signing on the user's smart card. 

Promise window.eparakstshwcrypto.sign(object certificate, object hash, object options)

Parameters

PropertyTypeMandatoryDescription
certificate
objectyesCertificate to use the corresponding private key for signing. An object corresponding to the Certificate data type was obtained using the getCertificate function.
hash
objectyesPrepared signable HASH value

type
stringyes

Signale HASH value algorithm type:

  • SHA-1
  • SHA-224
  • SHA-256
  • SHA-384
  • SHA-512

For Authentication

MD5-SHA1” type shall be used for end user authentication.

For Batch signing

JSON” type shall be used for batch signing

Batch signing is available in Chrome and Firefox 50+ browser versions


hex
stringyes

Signable HASH value in HEX encoding.

If "JSON" type is used, signable HASH values must be included in JSON object, which contains one or more "key:value" pairs, where:

"key" - Signale HASH value algorithm type;

"value" - Signable HASH value in HEX encoding

options
objectno

Signing conditions


lang

string

no

Preferred user interface language (ISO-639-1 code).

Supported languages:

  • en - English (default value);
  • lv - Latvian;
  • ru - Russian.

The user interface language is not fully affected because the language used can be determined by the operating system or browser.


operation

string

no

Type of operation:

  • sign - document signing (signing certificate will be returned) (default value);
  • auth - user authentication (authentication certificate will be returned)

info
stringnoInformative text (document title, transaction amount, etc.).

Result

Returns the Promise object that corresponds to the Signature data type.

Errors

Expected errors:

  • no_implementation;
  • invalid_argument;
  • user_cancel;
  • technical_error;
  • pin_blocked.

See section JavaScript API Error Handling.

  • No labels