Skip to content

Commit

Permalink
use new build-signature endpoint on avm service
Browse files Browse the repository at this point in the history
  • Loading branch information
celuchmarek committed Nov 18, 2024
1 parent d1ca917 commit 9375d99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ def datatosign(signing_certificate)
def sign(key, data_to_sign, signed_data)
response = avm_service.sign(self, data_to_sign, signed_data)

document = response['documentResponse']
encrypt_file(key, document.dig('filename'), document['mimeType'], document['content'])
encrypt_file(key, response.dig('filename'), response['mimeType'], response['content'])
self.last_signed_at = Time.current
save!

response['signer']
{
'signedBy': response['signedBy'],
'issuedBy': response['issuedBy']
}
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/avm_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def datatosign(document, signing_certificate)
end

def sign(document, datatosign_structure, signed_data)
response = Faraday.post(url('/sign'), {
response = Faraday.post(url('/build-signature'), {
"originalSignRequestBody": {
document: {
filename: document.encrypted_content.filename,
Expand Down

0 comments on commit 9375d99

Please sign in to comment.