Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vereign Client Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
Vereign Client Library
Merge requests
!57
Ssj 1 signing service java initial
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ssj 1 signing service java initial
SSJ-1-signing-service-java-initial
into
master
Overview
0
Commits
7
Pipelines
0
Changes
2
Merged
Damyan Mitev
requested to merge
SSJ-1-signing-service-java-initial
into
master
5 years ago
Overview
0
Commits
7
Pipelines
0
Changes
2
Expand
https://code.vereign.com/code/signing-service-java/issues/2
0
0
Merge request reports
Compare
master
version 1
712e3c01
5 years ago
master (base)
and
latest version
latest version
451ee067
7 commits,
5 years ago
version 1
712e3c01
6 commits,
5 years ago
2 files
+
105
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
javascript/src/iframe/viamapi-iframe.js
+
82
−
0
Options
@@ -1194,8 +1194,12 @@ const connection = Penpal.connectToParent({
certificatePEM
:
certificateOneTime
}
=
keys
;
passportChain
.
reverse
();
passportChain
.
push
(
passportCertificate
);
passportChain
.
reverse
();
const
pdfContentType
=
"
application/pdf
"
;
if
(
documentContentType
!==
pdfContentType
)
{
@@ -1271,6 +1275,84 @@ const connection = Penpal.connectToParent({
return
encodeResponse
(
"
200
"
,
""
,
"
Document signed
"
);
},
signDocumentJava
:
async
(
passportUUID
,
documentUUID
,
documentContentType
)
=>
{
const
authenticationPublicKey
=
localStorage
.
getItem
(
"
authenticatedIdentity
"
);
if
(
!
authenticationPublicKey
||
!
window
.
loadedIdentities
[
authenticationPublicKey
]
||
!
extendPinCodeTtl
(
authenticationPublicKey
)
)
{
return
encodeResponse
(
"
400
"
,
""
,
"
Identity not authenticated
"
);
}
const
certResponse
=
await
getCertificateForPassport
(
passportUUID
,
true
);
if
(
certResponse
.
code
!==
"
200
"
)
{
return
encodeResponse
(
"
400
"
,
""
,
certResponse
.
status
);
}
const
{
x509Certificate
:
passportCertificate
,
privateKey
:
passportPrivateKey
,
chain
:
passportChain
}
=
certResponse
.
data
;
const
keys
=
await
createOneTimePassportCertificate
(
makeid
()
+
"
-
"
+
passportUUID
,
null
,
passportPrivateKey
,
passportCertificate
);
const
{
privateKeyPEM
:
privateKeyOneTime
,
certificatePEM
:
certificateOneTime
}
=
keys
;
passportChain
.
reverse
();
passportChain
.
push
(
passportCertificate
);
passportChain
.
push
(
certificateOneTime
);
passportChain
.
reverse
();
const
pdfContentType
=
"
application/pdf
"
;
if
(
documentContentType
!==
pdfContentType
)
{
const
convResponse
=
await
executeRestfulFunction
(
"
private
"
,
window
.
viamApi
,
window
.
viamApi
.
documentConvertDocumentByUUID
,
null
,
documentUUID
,
documentContentType
,
pdfContentType
);
if
(
convResponse
.
code
!==
"
200
"
)
{
return
encodeResponse
(
"
400
"
,
""
,
convResponse
.
status
);
}
}
const
signResponse
=
await
executeRestfulFunction
(
"
private
"
,
window
.
viamApi
,
window
.
viamApi
.
documentSignDocumentJavaService
,
null
,
privateKeyOneTime
,
passportChain
,
passportUUID
,
documentUUID
,
pdfContentType
);
if
(
signResponse
.
code
!==
"
200
"
)
{
return
encodeResponse
(
"
400
"
,
""
,
signResponse
.
status
);
}
return
encodeResponse
(
"
200
"
,
""
,
"
Document signed
"
);
},
documentCreateDocument
:
async
(
passportUUID
,
path
,
contentType
,
title
)
=>
{
const
authenticationPublicKey
=
localStorage
.
getItem
(
"
authenticatedIdentity
"
Loading