bcgov / aries-oca-bundles

aries-oca-bundles
Apache License 2.0
8 stars 20 forks source link

how do we know a bundle has been updated? #82

Closed cvarjao closed 9 months ago

cvarjao commented 12 months ago

Do we need any sort of checksum or anything that signals a consumer (wallet app) that the bundle has been updated, and it needs to re-download the bundle and update the local cache?

swcurran commented 12 months ago

Not currently present, but you are right, it should be added. Can be done as part of the generation of the ocabundles.json creation — added item per identifier.

Doh!

swcurran commented 11 months ago

Would it be sufficient to do a md5sum OCABundle.json, and include that in the ocabundles.json that the wallet loads to get a list of identifiers and OCA File locations? The wallet still needs to get the ocabundles.json, but could see if the mda5sum is the same for each OCA Bundle, and only retrieve the OCA Bundle if the file changes, or it is a new one. Or just load new ones when they are used…

No need AFAIK to check the mda5sum in the wallet — just used to know if there has been an update or not.

Easy change…let me know what you think.

cvarjao commented 11 months ago

I agree. I think a checksum of some sort should work

swcurran commented 11 months ago

OK - I’ll add it. Should be easy...

swcurran commented 9 months ago

@amanji @cvarjao -- I've implemented this by adding a SHA256 field along with the path in the ocabundle.json and ocabundlelist.json files. Will the current implementation in the BC Wallet (and OCA Explorer) still handle the JSON and just ignore the added JSON item, or do we need to update the consumer code before we add this into the repo?

Current Format Example:

{
   "AcZpBDz3oxmKrpcuPcdKai:2:Digital Business Card:1.0.0": { "path": "OCABundles/schema/bcgov-digital-trust/business-card/OCABundle.json" },
   "K9igebFysBL6jcBwR8bKuN:2:Digital Business Card:1.0.0": { "path": "OCABundles/schema/bcgov-digital-trust/business-card-showcase/OCABundle.json" }
}

New Format Example:

{
   "AcZpBDz3oxmKrpcuPcdKai:2:Digital Business Card:1.0.0": { "path": "OCABundles/schema/bcgov-digital-trust/business-card/OCABundle.json", "sha256": "34804dbb328cd8741d048121963786f4be63c654abdf0757a10f477c8e8924d5" },
   "K9igebFysBL6jcBwR8bKuN:2:Digital Business Card:1.0.0": { "path": "OCABundles/schema/bcgov-digital-trust/business-card-showcase/OCABundle.json", "sha256": "aa4dc9de20639a77ab53c419e9e46f405008be170e68ddf4d22551cc0a6be230" }
}
cvarjao commented 9 months ago

@swcurran, I think that is good enough. @wadeking98 anything else you might need for caching/updating OCA bundle files?

swcurran commented 9 months ago

@cvarjao — doesn’t answer my question. Can we just add that item and existing code will work, or will it break the existing code and we’ll need to update the code (to handle both formats) before we can update the file?

cvarjao commented 9 months ago

it should not break, but @wadeking98 know the implementation better.

wadeking98 commented 9 months ago

I agree with @cvarjao the BC Wallet should be fine

swcurran commented 9 months ago

Good stuff — thanks. Once we approve and merge #102 I’ll update the script to add this feature to the generated files.

102 allows Bundles to be in any folder with the OCABundles folder, so that we can better organize the bundles — e.g. person can have multiple version (production, test, unverified) below it vs. all being beside each other.

swcurran commented 9 months ago

This issue is complete. @wadeking98 @cvarjao -- please let me know when this is in use in BC Wallet. Not that I need to know -- just interested. Let me know if you have any questions :-).