_documents container (Alpha2)


#1

Are all of the containers mentioned in the RFC currently implemented? I’m trying to access ‘_documents’ via the webapi playground, but it isn’t working. Am I just doing something wrong?

steps executed:

() => {

      let appInfo = {
        id: 'net.maidsafe.api_playground.webclient.10',
        name: 'SAFE web API playground',
        vendor: 'MaidSafe Ltd.',
        scope: null
      };

      return window.safeApp.initialise(appInfo).then(function (res) {
        appHandle = res;
        return 'Returns app token: ' + res;
      });
    }

() => {
      return window.safeApp.authorise(appHandle, {
        _documents: ['Read', 'Insert', 'Update']
      }, { own_container: true }).then(res => {
        authUri = res;
        return 'App was authorised and auth URI received: ' + res;
      });
    }

() => {
      return window.safeApp.connectAuthorised(appHandle, authUri).then(appHandle => {
        return 'The app was authorised and a session was created with the network. App token returned: ' + appHandle;
      });
    }

() => {
      let container = '_documents';
      let permissions = ['Read','Insert','Update'];
      return window.safeApp.canAccessContainer(appHandle, container, permissions).then(r => {
        return 'Has the app ' + permissions + ' permission for container ' + container + '?: ' + r;
      });
    }

() => {
      let container = '_documents';
      return window.safeApp.getContainer(appHandle, container).then(res => {
        mdHandle = res;
        return 'Returns handle to Mutable Data behind ' + container + ' container: ' + res;
      });
    }

console output:

Returns app token: 851e06a5facf7e3c91dbb34ae7e470967d12920b0d91fb8f0e0b71b0ff8bb70b
client-scripts.js:2011 App was authorised and auth URI received: safe-bmV0Lm1haWRzYWZlLmFwaV9wbGF5Z3JvdW5kLndlYmNsaWVudC4xMA==:AQAAALYgSfgAAAAAAAAAACAAAAAAAAAAklLiz6gaJHv9Vb2LWt5dch5Ap8f5l9c3rNRElfAyoJogAAAAAAAAAHTsz_qgK79G6dPEzXc1ft49hmklrQvjgrHRdFk75os0IAAAAAAAAAAkctmSruNOdhNBWaQMd3pshLdUBsFKB_VkCisi_Q369UAAAAAAAAAAOTYjIt0Hi-PN7TjN3WZ3MEZncHkxSN760ZJM0p5XxMwkctmSruNOdhNBWaQMd3pshLdUBsFKB_VkCisi_Q369SAAAAAAAAAAUEBZuP1RDxp93Y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AAAAAAAGAAAAAAAAADYXLxUy3dZCJQKG9NLZA7SFMuuS4Fb-f0=
client-scripts.js:2011 The app was authorised and a session was created with the network. App token returned: 851e06a5facf7e3c91dbb34ae7e470967d12920b0d91fb8f0e0b71b0ff8bb70b
/opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:228 Uncaught (in promise) Error: Cannot read property 'Read' of undefined
    at perms.every (/opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/@maidsafe/safe-node-app/src/api/auth.js:263:55)
    at Array.every (native)
    at getContainersPermissions.then (/opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/@maidsafe/safe-node-app/src/api/auth.js:263:30)
    at <anonymous>
createError @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:228
asyncCbs.push @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:62
onCbReply @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:217
onIPCMessage @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:149
emitMany @ events.js:127
emit @ events.js:204
/opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:228 Uncaught (in promise) Error: Container not found
    at module.exports (/opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_error.js:19:10)
    at /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_base.js:121:57
    at /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/ffi/lib/callback.js:66:25
createError @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:228
asyncCbs.push @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:62
onCbReply @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:217
onIPCMessage @ /opt/maidsafe/safe-browser-v0.6.0/resources/app/node_modules/pauls-electron-rpc/lib/import-api.js:149
emitMany @ events.js:127
emit @ events.js:204

#2

I think only _public, _publicnames and your app own container are currently available.


#3

Then I’m not going to try it yet on my safe://todo (instead of _public) :wink:
I was also wondering if it that much more safe to have encrypted entries on a private container, like _documents instead of non encrypted like _public.
Only your own account does know the address of its _public container is it not?
Maybe that an unauthorized app started on your computer can read something in the _public container?


#4

This topic was automatically closed after 60 days. New replies are no longer allowed.