From fb8cdef4c10c78a2a59ef797ce7efc3fcb82a594 Mon Sep 17 00:00:00 2001
From: Damyan Mitev <damyan.mitev@vereign.com>
Date: Mon, 27 May 2019 17:50:56 +0300
Subject: [PATCH] in documentCreateDocument swap path and passportUUID, add
 title

also remove errorneous implementation of documentGetDocument
---
 javascript/src/iframe/viamapi-iframe.js | 28 +++----------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/javascript/src/iframe/viamapi-iframe.js b/javascript/src/iframe/viamapi-iframe.js
index a0b90a2..5840a69 100644
--- a/javascript/src/iframe/viamapi-iframe.js
+++ b/javascript/src/iframe/viamapi-iframe.js
@@ -1075,7 +1075,7 @@ const connection = Penpal.connectToParent({
 
       return encodeResponse("200", "", "Document signed");
     },
-    documentCreateDocument: async (path, passportUUID, contenttype) => {
+    documentCreateDocument: async (passportUUID, path, contentType, title) => {
       const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
       if (
         !authenticationPublicKey ||
@@ -1089,7 +1089,8 @@ const connection = Penpal.connectToParent({
         headers: {
           path,
           passportuuid: passportUUID,
-          contenttype
+          contentType,
+          title
         }
       };
       const response = await executeRestfulFunction("private", window.viamApi, window.viamApi.documentCreateDocument,
@@ -1121,29 +1122,6 @@ const connection = Penpal.connectToParent({
 
       return encodeResponse("200", response.data, "Document stored");
     },
-    documentGetDocument: async (passportUUID, resourceid, contentType) => {
-      const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
-      if (
-        !authenticationPublicKey ||
-        !window.loadedIdentities[authenticationPublicKey] ||
-        !extendPinCodeTtl(authenticationPublicKey)
-      ) {
-        return encodeResponse("400", "", "Identity not authenticated");
-      }
-
-      const config = {
-        headers: {
-          passportuuid: passportUUID,
-          resourceid,
-          contentType
-        }
-      };
-
-      const response = await executeRestfulFunction(
-        "private", window.viamApi, window.viamApi.documentGetDocument, config);
-
-      return encodeResponse("200", response.data, "Document retrieved");
-    },
     hasSession() {
       return new Penpal.Promise(result => {
         const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
-- 
GitLab