Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published

Validate digital signature

Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature and returns result.
See service specification

  1. Ensure that digital signature is valid

  2. Validate that recorded_by of procedure is a current user

2.1. Get token metadata

  • Extract user_idclient_idclient_type

2.2. Determine the party_id associated with this user_id

Code Block
SELECT pu.party_id 
FROM party_users pu 
WHERE pu.user_id = :user_id;

2.3. Determine employees related to this party_id in current MSP

Code Block
SELECT e.id 
FROM employees e 
WHERE e.party_id = :party_id AND e.legal_entity_id = :client_id;

2.4 Ensure that $.recorded_by.identifier.value matches with user employees

  • in case error return 409, "Employees do not belong to the same party_id"

  1. Validate that DS belongs to recorded_by

3.1. Determine the party_id associated with recorded_by ($.recorded_by.identifier.value)

Code Block
SELECT p.tax_id 
FROM employees e, parties p 
WHERE e.party_id = p.id AND e.id = :recorded_by;