-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implementing Pluto Repositories #160
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @curtis-h, great work really!
TBH, I like the implementation a lot, but I miss a bit of higher level context to be able to reason about it properly, like:
- what are the decision drivers here?
- what specific problem are we addressing exactly? why is it worth the effort?
- what's the ideal solution and under what assumptions?
- what are the tradeoffs of the chosen approach?
I think SDK is mature enough now to start addressing bigger changes in a more structured way (with a bit of good friction). Otherwise, we are going to solve the same problems again and again.
Please consider this only as a proposal to discuss inside the team, I'm ok with proceeding with this one as is, it (de facto) looks better than the existing implementation.
Thanks @milosh86 what are the decision drivers here?
what specific problem are we addressing exactly? why is it worth the effort?
what's the ideal solution and under what assumptions?
what are the tradeoffs of the chosen approach?
|
Schemas
Query Selectors
Migrations Rollbacks?
Encrypted data
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added the missing demos and changes the alias as we agreed.
Awesome work man, well done!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole point of bringing this is to facilitate maintenance and future migrations on the user, developed side.
Migration paths are a key feature or our solution and not including them makes it harder for the user to maintain, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this now bundles a complete migration solution that will support the existing community storage packages and allow us to maintain migrations on our side.
We can upgrade model attributes from A to B, but we can also completely remove A and migrate all its rows to a new model which is completely different.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@curtis-h @elribonazo I reviewed this version in detail and I like it, looks quite clean and haven't noticed anything potentially problematic. We introduced RxDB, but in return we got some nice features out of the box.
@elribonazo one question for you. Are you happy now how this work relates to the pluto-encrypted
package. Do you think that migration path for users is obvious?
UPDATE: Great job both of you 🙌💪
Are you happy now how this work relates to the pluto-encrypted package. Do you think that migration path for users is obvious? @milosh86, yes really because in the current scenario this will not require much changes from the user in terms of code, re-implementing the storages, etc. So users still have encrypted (inmemory, or leveldb, or indexdb) The migration is specified in the models and because models are right now provided by our package, this means that migration of data is something transparent for the users. The data will grow over time and this will facilitate transition to new models. This was in place before but because it was in pluto-encrypted and not in the SDK, for every change in the SDK, i have to release another version of pluto-encrypted. This will never happen anymore, pluto-encrypted/database, pluto-encrypted/encryption will be deprecated and only the storages will be maintained. Last, despite we have facilitated lots of things for our users, we are still not taking a decision on where it should be stored and how it should be encrypted, that's something that very advanced user's could implement themselves, the encryption happens at storage level and because storage doesn't speak models, doesn't know what they are maintenance is extremely simple for users. |
|
…nd implement the delete method for now.
# Conflicts: # demos/next/package-lock.json # demos/next/package.json # demos/next/src/app/state.ts # demos/next/src/pages/index.tsx # package-lock.json # package.json
BREAKING CHANGE: - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
# [5.0.0](v4.0.0...v5.0.0) (2024-02-28) ### Bug Fixes * add reference app + mediator live mode ([#177](#177)) ([6ebf48a](6ebf48a)) * e2e tests improvement ([#178](#178)) ([eb6a5ab](eb6a5ab)) * key's id name according to the DID Peer new specs [#126](#126) ([#148](#148)) ([a851b69](a851b69)) * Manually generating the missing changelog and breaking changes b… ([#167](#167)) ([24ecc04](24ecc04)) * Recover JTI field correctly. Allowing to regenerate the original JWT string ([#171](#171)) ([913f3fa](913f3fa)) * feat!: Implementing Pluto Repositories (#160) ([ce7669f](ce7669f)), closes [#160](#160) ### BREAKING CHANGES * - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
BREAKING CHANGE: - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
# [5.0.0](v4.0.0...v5.0.0) (2024-02-28) ### Bug Fixes * add reference app + mediator live mode ([#177](#177)) ([6ebf48a](6ebf48a)) * e2e tests improvement ([#178](#178)) ([eb6a5ab](eb6a5ab)) * key's id name according to the DID Peer new specs [#126](#126) ([#148](#148)) ([a851b69](a851b69)) * Manually generating the missing changelog and breaking changes b… ([#167](#167)) ([24ecc04](24ecc04)) * Recover JTI field correctly. Allowing to regenerate the original JWT string ([#171](#171)) ([913f3fa](913f3fa)) * feat!: Implementing Pluto Repositories (#160) ([ce7669f](ce7669f)), closes [#160](#160) ### BREAKING CHANGES * - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
Co-authored-by: Francisco Javier Ribó Labrador <[email protected]> Signed-off-by: Francisco Javier Ribó Labrador <[email protected]> Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
BREAKING CHANGE: - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
# [5.0.0](v4.0.0...v5.0.0) (2024-02-28) ### Bug Fixes * add reference app + mediator live mode ([#177](#177)) ([6ebf48a](6ebf48a)) * e2e tests improvement ([#178](#178)) ([eb6a5ab](eb6a5ab)) * key's id name according to the DID Peer new specs [#126](#126) ([#148](#148)) ([a851b69](a851b69)) * Manually generating the missing changelog and breaking changes b… ([#167](#167)) ([24ecc04](24ecc04)) * Recover JTI field correctly. Allowing to regenerate the original JWT string ([#171](#171)) ([913f3fa](913f3fa)) * feat!: Implementing Pluto Repositories (#160) ([ce7669f](ce7669f)), closes [#160](#160) ### BREAKING CHANGES * - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
BREAKING CHANGE: - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
# [5.0.0](v4.0.0...v5.0.0) (2024-02-28) ### Bug Fixes * add reference app + mediator live mode ([#177](#177)) ([6ebf48a](6ebf48a)) * e2e tests improvement ([#178](#178)) ([eb6a5ab](eb6a5ab)) * key's id name according to the DID Peer new specs [#126](#126) ([#148](#148)) ([a851b69](a851b69)) * Manually generating the missing changelog and breaking changes b… ([#167](#167)) ([24ecc04](24ecc04)) * Recover JTI field correctly. Allowing to regenerate the original JWT string ([#171](#171)) ([913f3fa](913f3fa)) * feat!: Implementing Pluto Repositories (#160) ([ce7669f](ce7669f)), closes [#160](#160) ### BREAKING CHANGES * - Domain.Credential now has uuid (string) as an optional attribute in the class - Change StorePrismDID Function parameters, removing keyPathIndex and privateKeyMetadataId which were not in use - Small change in the getCredentialMetadata and getLinkSecret to return null when not found - Change Pluto interface to use CredentialMetadata class VS what it was using before. - Change Pluto interface, storeMediator now accepts a Mediator class and not 3 attributes, mediator, host and routing - Rename storePrivateKeys to storePrivateKey - Change Pluto interface, using Domain.PrismDID instead of Domain.PrismDID which is being removed - Added new properties to handle Anoncreds credentials properties. - Re-implemented Pluto which is now available again to all the users. import SDK from "@atala/prism-wallet-sdk"; import IndexDB from "@pluto-encrypted/indexdb"; const store = new SDK.Store({ name: "test", storage: IndexDB, password: Buffer.from("demoapp").toString("hex") }); const pluto = new SDK.Pluto(store, apollo); Migrations, schemas, queries and error handling have been moved to the SDK again but user's which were using the existing storages can just pass the indexDB pluto-encrypted storage and it will integrate with the new db schemas, migrations, etc
Description
Large reconsideration of Pluto, reintroducing an implementation that abstracts the storage layer, so we can write the logic and error handling without being coupled to a specific db etc.
The Pluto class now acts as an orchestration layer, only handling Domain objects, their logic and relationships.
The repository layer handles mapping Domain <-> Storable Models.
The Store abtracts the storage implementation with a simplified interface, handling Storable Models.
BREAKING CHANGES:
uuid
property.null
instead ofundefined
Pluto.storePrismDID
signature changed - unused arguments (keyPathIndex, metaId) removedCredentialMetadata
fetchCredentialMetadata
renamed togetCredentialMetadata
CredentialRequestOptions
updated to use Domain.LinkSecret andlinkSecretName
removedCreatePresentationProof
options updated to use Domain.LinkSecretstoreMediator
now takes Domain.Mediator, instead of three separate DIDsstorePrivateKeys
renamed tostorePrivateKey
as it only handles a single keyPrismDID
addedPrismDIDInfo
removedPrismDIDMethodId removed - functionality added to
PrismDID`getAllPrismDIDs
now returns Domain.PrismDIDsgetDIDInfoByDID
getDIDInfoByAlias
getPrismLastKeyPathIndex
- removedJira link
https://input-output.atlassian.net/browse/ATL-6148
https://input-output.atlassian.net/browse/ATL-5861
https://input-output.atlassian.net/browse/ATL-5863
Checklist