Giter Club home page Giter Club logo

Comments (28)

swcurran avatar swcurran commented on July 20, 2024 1

For the file to be loaded by a wallet or other agent, I would not include “publisher”, “type”, “name” or “description”. All of that is in the OCA Bundle and not needed. We want to minimize the file size to reduce load time and storage needs. My plan is to have a second file that has a list of the Bundles by Name and Description for use by something like OCA Explorer.

I’ll try to get the arrangement by DID. It’s a bit tricky to produce the file like that when traversing the file structure, but I think I can do it.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024 1

Do we need both if that information is present in the JSON for the wallet.

The wallet doesn’t need the info that the OCA Explorer needs. That’s why we have the compact file for the Wallet, and the expanded file for the OCA Explorer.

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024 1

@amanji — your latest doesn’t have the “” in the JSON — where should that be?

What does the "" refer to?

from aries-oca-bundles.

cvarjao avatar cvarjao commented on July 20, 2024

I think it is important that the lookup be very simple/lightweight and quick for a mobile app. A few options:

  1. replace special characters with another common accepted one? maybe - or _?
  2. name the folder after a hash?
    e.g.: Ep31SvFAetugFPe5CGzJxt:2:Attestation_numérique_didentité_gouvernemental_(EXP):1.0 becomes 18A27A2405DF870723D95AB80D90DE544FDB01134CC363467E3E924D528D391A (SHA-256)
    This would also apply for DIDs since did indy method and others may also have special characters such as :

I am not sure about this REDIRECT.md it adds another http request/round-trip. I need to think about it.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

So @cvarjao you are saying the two step -- load index, load oca-bundle is too much? Note that the wallet could cache the index, making the load a single step at credential processing time -- at the cost of holding some extra data in the wallet. Also -- it could be a 0 request step if there is no OCA Bundle for the credential -- no need to do anything more than the check the index.

If you look at the current process with the redirect, and with the option of using the CredDef or, if not found, the Schema, so there could be up to 4 requests now -- which also sucks. My feeling is that just fixing the foldernames is insufficient.

I am a bit worried about the size of the index over time (e.g. 100s of entries), but I think we move have a better longer term solution if that is a concern -- e.g. OCA Bundle on the ledger, returned with the CredDef.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

FYI -- I would like to add "PresentationRequests" to this so we can have Presentation Request templates in this repo.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

Folks -- revamped the idea per conversations with @cvarjao. Key changes:

  • No redirect file/concept
  • Markdown table to hold a list of <DID>, <identifier> pairs that use the OCABundle in the README.md

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

Here is what the CSV would look like if generated on the repo today:

"did", "identifier", "OCABundlePath"
"63ZiwyeZeazA6AhYRYm2zD", "63ZiwyeZeazA6AhYRYm2zD:2:Member Card:1.5.1", "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1"
"Trx3R1frdEzbn34Sp1jyX","Trx3R1frdEzbn34Sp1jyX:2:Member Card:1.5.1, "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1"
"63ZiwyeZeazA6AhYRYm2zD","63ZiwyeZeazA6AhYRYm2zD:2:student_card:1.0, "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:student_card:1.0"
"Ep31SvFAetugFPe5CGzJxt","Ep31SvFAetugFPe5CGzJxt:2:Attestation_numérique_didentité_gouvernemental_(EXP):1.0, "OCABundles/Ep31SvFAetugFPe5CGzJxt/Ep31SvFAetugFPe5CGzJxt:2:Attestation_numérique_didentité_gouvernemental_(EXP):1.0"
"Trx3R1frdEzbn34Sp1jyX","Trx3R1frdEzbn34Sp1jyX:2:student_card:1.0, "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:student_card:1.0"
"XUxBrVSALWHLeycAUhrNr9","XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1, "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1"
"XUxBrVSALWHLeycAUhrNr9","XUxBrVSALWHLeycAUhrNr9:2:Person:1.0, "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:Person:1.0"
"XUxBrVSALWHLeycAUhrNr9","XUxBrVSALWHLeycAUhrNr9:2:student_card:1.0, "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:student_card:1.0"
"YXCtXE4YhVjULgj5hrk4ML","YXCtXE4YhVjULgj5hrk4ML:2:unverified_person:0.1.0, "OCABundles/YXCtXE4YhVjULgj5hrk4ML/YXCtXE4YhVjULgj5hrk4ML:2:unverified_person:0.1.0"

@amanji -- would that work for you in either the wallet or the OCA Explorer? Or would you prefer a less compact representation such as JSON? And if JSON, please provide an example of the preferred format.

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

I think for ease of use across different platforms (browser, mobile, server), a JSON format would be optimal and would require no additional libraries to process.

My thoughts are the JSON format would be keyed by did as such:

{
    "<did>": [
        {
            "id": "<s_ID or cd_ID>",
            "path": "<path_to_bundle_json>",
            "publisher": "<publisher>",
            "type": "<\"s\" or \"cd\">",
            "name": "<name>",
            "description": "<description>"
        }
    ]
}

So for example:

{
    "63ZiwyeZeazA6AhYRYm2zD": [
        {
            "id": "63ZiwyeZeazA6AhYRYm2zD:2:Member Card:1.5.1",
            "path": "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1",
            "publisher": "Law Society of BC",
            "type": "s",
            "name": "Member Card",
            "description": "Member card for LSBC"
        }, {
            "id": "63ZiwyeZeazA6AhYRYm2zD:2:student_card:1.0",
            "path": "OCABundles/XUxBrVSALWHLeycAUhrNr9/XUxBrVSALWHLeycAUhrNr9:2:student_card:1.0",
            "publisher": "BestBC College",
            "type": "s",
            "name": "Student Card",
            "description": "A student card for BestBC College"
        },
        ...
    ],
    "XUxBrVSALWHLeycAUhrNr9": [ ... ],
    ...
    ""
}

This should also work for the redirects as proposed. Adding additional bundles to existing DIDs should be as easy as pushing a new object to the array value for that DID. Creating a new DID entry would be a simple key addition to the root object with an array value of the bundle(s) for that DID.

from aries-oca-bundles.

cvarjao avatar cvarjao commented on July 20, 2024

I was thinking on it being keyed by schema id and/or cred definition id. That should make for an easy lookup from the wallet (as it it how it already working). I am thinking from a quick lookups perfective.
Or is there any advantage to use DID key that I might be missing?

Something like:

if (index[schema_id_OR_cred_def_id]) {
   // found a bundle associated with a schema id or cred_def_id
  let bundle = cache[schema_id_OR_cred_def_id]
   if (!bundle) {
       const bundle = await fetch_bundle(schema_id_OR_cred_def_id)
       if (!bundle) throw new Error('Oops. Bundle should be fetchable');
       cache[schema_id_OR_cred_def_id]= bundle
   }
}

I am coming from the repository working as a remote caching and the data structures is as close as possible to be readily used, with little to none extra processing.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

@cvarjao -- so what would the JSON look like? I agree we can leave off the DID.

Just:

[
    "<id>": "<path>",
    "<id>": "<path>",
]

from aries-oca-bundles.

cvarjao avatar cvarjao commented on July 20, 2024

yes, as json object:

{
    "<id>": "<path>",
    "<id>": "<path>",
}

Do you think there is any value in the value being an object for future use?

{
    "<id>": { path: "<path>" },
    "<id>": { path: "<path>" },
}

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

So to be clea,r we would modify the structure above to be:

{
    "<s_ID or cd_ID>": {
        "id": "<s_ID or cd_ID>",
        "path": "<path_to_bundle_json>",
        "publisher": "<publisher>",
        "type": "<\"s\" or \"cd\">",
        "name": "<name>",
        "description": "<description>"
    }
}

The id property is redundant.

The call above would be:

const bundle = await fetch_bundle(index[schema_id_OR_cred_def_id].path)

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

@amanji — we have two separate files. One with just the ID and path, the other with path, publisher, type, name and description. The first file is for wallets and agents, the second file is for OCA Explorer.

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

@swcurran Do we need both if that information is present in the JSON for the wallet.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

@cvarjao — the one thing I note is the that “id” can have a space in it. Is that an issue for using the “” being the JSON item?

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

Do we need both if that information is present in the JSON for the wallet.

The wallet doesn’t need the info that the OCA Explorer needs. That’s why we have the compact file for the Wallet, and the expanded file for the OCA Explorer.

I see. I was mistakenly thinking the opposite.

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

I properly read your comment above. I see why both are being proposed. Thanks!

I think they should still follow the same structure then:

Key by "<s_ID or cd_ID>" and value is an object (for the wallet this would just contain the path)

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

When I do just [ “<id>”: “<path>”, … ] I get a JSON error — the validator thinks the “:” shouldn’t be there.

I can get this to validate: [ { “id”: “<id>”, “path”: “<path>”}, …]

Is that OK?

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

[ “<id>”: “<path>”, … ] is not valid JSON since key/values need to be in an object (they are in an array here). The second one is ok but I think it still should be:

{ "id": { "path": "<path>"} }

Based on the suggestion above by @cvarjao to make for the easiest/most direct processing

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

@amanji — your latest doesn’t have the “<id>” in the JSON — where should that be?

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

I properly read your comment above. I see why both are being proposed. Thanks!

I think they should still follow the same structure then:

Key by "<s_ID or cd_ID>" and value is an object (for the wallet this would just contain the path)

A couple of reasons not to do that:

For the OCA Explorer JSON, the ID is irrelevant as we aren’t using it for anything. I think what we want is to display a list of human readable Publisher+names for the bundles, or perhaps provide a search on the publisher, names, description. But we don’t want to list them by the obscure IDs.

As well, for the OCA Explorer, we only want the Bundle to be listed once. If we key off the ID, we can get the same Bundle listed multiple times — when it is reused by different identifiers.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

@amanji — your latest doesn’t have the “<id>” in the JSON — where should that be?

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

Assuming "<id>" cannot be "" then the object would be: { "<id>": { "path": "<path>"} }

from aries-oca-bundles.

amanji avatar amanji commented on July 20, 2024

@amanji — your latest doesn’t have the “” in the JSON — where should that be?

What does the "" refer to?

Weird the content in the angle braces wasn't showing up.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

That gives invalid JSON. Zoom time — see rocketchat.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

OK — all figured out. DIDs removed, JSON set — two files. Still need to do the documentation, and then I’ll put in the PR. Sorry for the painful discussion.

from aries-oca-bundles.

swcurran avatar swcurran commented on July 20, 2024

Fixed -- woot! #25

from aries-oca-bundles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.