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
24
Issue boards
Milestones
Wiki
Code
Merge requests
5
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
0d00247d
Commit
0d00247d
authored
5 years ago
by
Damyan Mitev
Browse files
Options
Downloads
Patches
Plain Diff
add validateVCard
parent
5a06292a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!75
Implement validation of VCard
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
javascript/src/iframe/viamapi-iframe.js
+71
-0
71 additions, 0 deletions
javascript/src/iframe/viamapi-iframe.js
with
71 additions
and
0 deletions
javascript/src/iframe/viamapi-iframe.js
+
71
−
0
View file @
0d00247d
...
...
@@ -1575,6 +1575,77 @@ const connection = Penpal.connectToParent({
messageUUID
:
messageUUID
,
},
"
vCard signed
"
);
},
// vCardImageData = {
// contentType: "image/png",
// contentBase64: base 64 encoded image
// };
// text, html - the text and html part of the email
// related, attachments - array of objects, containing hashes of images/objects, related to the html in format:
// {
// headers: {
// "Content-Type": "application/hash; algorithm=SHA-256",
// "Original-Content-Type": "image/jpeg", //original content type
// "Content-Disposition": "inline" or "attachment",
// ... //other headers
// },
// body: "base64 encoded hash"
// }
validateVCard
:
async
(
vCardImageData
,
text
,
html
,
parts
=
null
)
=>
{
const
authenticationPublicKey
=
localStorage
.
getItem
(
"
authenticatedIdentity
"
);
if
(
!
authenticationPublicKey
||
!
window
.
loadedIdentities
[
authenticationPublicKey
]
||
!
extendPinCodeTtl
(
authenticationPublicKey
)
)
{
return
encodeResponse
(
"
400
"
,
""
,
"
Identity not authenticated
"
);
}
//vCardImageData = new ImageData(vCardImageData);
if
(
!
parts
)
{
parts
=
[];
}
if
(
html
)
{
const
htmlPart
=
{
headers
:
{
"
Content-Type
"
:
"
text/html
"
},
body
:
stringToUtf8Base64
(
html
)
};
parts
.
unshift
(
htmlPart
);
}
if
(
text
)
{
const
textPart
=
{
headers
:
{
"
Content-Type
"
:
"
text/plain
"
},
body
:
stringToUtf8Base64
(
text
)
};
parts
.
unshift
(
textPart
);
}
const
validateVCardResponse
=
await
executeRestfulFunction
(
"
private
"
,
window
.
viamApi
,
window
.
viamApi
.
signValidateVCard
,
null
,
parts
);
if
(
validateVCardResponse
.
code
!==
"
200
"
)
{
return
encodeResponse
(
"
400
"
,
""
,
validateVCardResponse
.
status
);
}
//TODO - what will be the response?
const
signedVCardImageData
=
new
ImageData
(
validateVCardResponse
.
data
);
return
encodeResponse
(
"
200
"
,
signedVCardImageData
,
"
vCard signed
"
);
},
generateQrCode
,
documentCreateDocument
:
async
(
passportUUID
,
path
,
contentType
,
title
)
=>
{
const
authenticationPublicKey
=
localStorage
.
getItem
(
...
...
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