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
Commits
7c3e23e5
Commit
7c3e23e5
authored
6 years ago
by
Sasha Ilieva
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 553-filter-interactions
parents
a8e51975
3c39f5e6
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!53
Ability to search and filter Inbox(Emails and Documents)
This commit is part of merge request
!53
. Comments created here will be created in the context of that merge request.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
javascript/src/iframe/viamapi-iframe.js
+82
-0
82 additions, 0 deletions
javascript/src/iframe/viamapi-iframe.js
javascript/src/utilities/signingUtilities.js
+23
-0
23 additions, 0 deletions
javascript/src/utilities/signingUtilities.js
with
105 additions
and
0 deletions
javascript/src/iframe/viamapi-iframe.js
+
82
−
0
Edit
View file @
7c3e23e5
...
...
@@ -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
"
...
...
This diff is collapsed.
Click to expand it.
javascript/src/utilities/signingUtilities.js
+
23
−
0
Edit
View file @
7c3e23e5
...
...
@@ -124,8 +124,28 @@ function generateKeys(algorithms) {
return
crypto
.
generateKey
(
algorithm
.
algorithm
,
true
,
algorithm
.
usages
);
}
function
fixPkijsRDN
()
{
pkijs
.
RelativeDistinguishedNames
.
prototype
.
toSchema
=
function
()
{
//region Decode stored TBS value
if
(
this
.
valueBeforeDecode
.
byteLength
===
0
)
// No stored encoded array, create "from scratch"
{
return
(
new
asn1js
.
Sequence
({
value
:
Array
.
from
(
this
.
typesAndValues
,
element
=>
new
asn1js
.
Set
({
value
:
[
element
.
toSchema
()]}))
}));
}
const
asn1
=
asn1js
.
fromBER
(
this
.
valueBeforeDecode
);
//endregion
//region Construct and return new ASN.1 schema for this object
return
asn1
.
result
;
//endregion
};
}
//*********************************************************************************
function
createCertificate
(
certData
,
issuerData
=
null
)
{
if
(
typeof
certData
===
"
undefined
"
)
{
return
Promise
.
reject
(
"
No Certificate data provided
"
);
}
...
...
@@ -1252,3 +1272,6 @@ export const verifySMIME = (smimeString, rootCaPem) => {
},
50
);
});
};
//Initialization block
fixPkijsRDN
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment