finos / FDC3

An open standard for the financial desktop.
https://fdc3.finos.org
Other
201 stars 132 forks source link

Updating SessionStorage data format to additionally scope data #1442

Open kriswest opened 2 days ago

kriswest commented 2 days ago

Describe your change

Updates the description of and types governing the use SessionStorage by getAgent to scope the data by identityUrl and window.name, thus ensuring iframes in a common window don't overwrite each others data and data for multiple different apps on teh same origin can be retained (to support navigating to a different app and then back again).

Docs preview deeplink: https://deploy-preview-1442--fdc3.netlify.app/docs/next/api/ref/GetAgent#persisted-connection-data

Related Issue

resolves #1430

Contributor License Agreement

Review Checklist

netlify[bot] commented 2 days ago

Deploy Preview for fdc3 ready!

Name Link
Latest commit 662d28aa4e0d38a2952e767c313bfb3ff403d9b4
Latest deploy log https://app.netlify.com/sites/fdc3/deploys/6740b1127b6ee800089d083d
Deploy Preview https://deploy-preview-1442--fdc3.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Roaders commented 8 hours ago

I read the docs and I'm afraid I couldn't figure out what it's trying to tell me. It talks about generating a key by appending window.name to "FDC3-Desktop-Agent-Details-" but it then also talks about the key being the identity url.

Ah... I think I have it. The identityURL is used as the key in the session storage. The key above is then used within the object saved to session storage.

so you would access it something like this:

const sessionData = sessionStorage.get(myApIdentityUrl);
const agentDetails = sessionStorage["FDC3-Desktop-Agent-Details-myWindowName"];

I think that it might make it clearer if you include some sample code like that.... (there is always the possibility that I am just being stupid and it's perfectly clear to everyone else!)

kriswest commented 5 hours ago

HI @Roaders, thanks for reading that and for the code suggestion that would make it clearer. I did intend it the other way round:

const sessionData:SessionStorageFormat = sessionStorage.get("FDC3-Desktop-Agent-Details-myWindowName");
const agentDetails: DesktopAgentDetails = sessionStorage["myApIdentityUrl"];

As multiple (same-origin) apps could have been loaded in one window. I'll drop an update to clarify.