-
Notifications
You must be signed in to change notification settings - Fork 21
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(pollux): update storage for static resources to be wrapped in an envelope #1283
feat(pollux): update storage for static resources to be wrapped in an envelope #1283
Conversation
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
ErrorResponse, | ||
CredentialSchemaResponse, | ||
CredentialSchemaResponse | CredentialSchemaDidUrlResponse, |
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.
Does it make sense to unpack the DIDURLResponse and use CredentialSchemaResponse everywhere?
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.
Why do you mean by unpack? I did not get it
} | ||
|
||
override def getSchemaByGuid(guid: UUID)(implicit | ||
override def getSchemaByGuid(config: AppConfig, guid: UUID)(implicit |
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.
Passing an entire AppConfig object is a code smell.
From a long-term perspective, it creates a coupling between the application conf and the schema API.
Passing the required parameters (or the object with these parameters) to the function would be better.
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.
Makes sense
...la/org/hyperledger/identus/pollux/credentialschema/http/CredentialSchemaDidUrlResponse.scala
Show resolved
Hide resolved
@shotexa, good progress with schemas. What do I propose:
Having this segregation will make everything simple for usage and adoption. Business logic will be straightforward, and unit/e2e tests will be much simpler to write. The maintainability of this code will also be much better. NOTE: The naming convention for the paths can be changed; the main idea is to segregate different specs for the different routes. CC: @bvoiturier, @mineme0110 |
@yshyn-iohk Regarding the above comment, I think we are mixing different concepts here. From my point of view, the schema formats we support (JSON and AnonCreds) and their CRUD endpoints are orthogonal to the retrieval methods we want to support (direct http request to the schema or resolution through DID URL that contains a 'service' entry indicating the schema URL to fetch). So, if deemed necessary, we could split schema CRUD operations into two sets of endpoints - one for JSON and one for AnonCreds - but I don't understand the reasoning behind having additional endpoints for a "VDR variation" or for "HTTP/PrismDID AnonCreds methods" 🤔 |
Yeah, so from what I understood, @yshyn-iohk is suggesting having 2 sets of endpoints for every schema operation, just like now I have 2 endpoints for creation, one for creating schema that is resolvable via HTTP, and one that is resolvable via DID URL, @yshyn-iohk you are suggesting to have all endpoints (get, update, get many) to have separate for HTTP URLs and DID URLs. do I understand this correctly? Right now I only have the creation endpoint split into two, get endpoint for example, it might return schema as normal (like now), or wrapped in an envelope (as it was created to be resolvable via DID URL) |
I'm suggesting to isolate the schema's APIs by |
@bvoiturier, regarding |
I find it a bit hard to follow, specifically with differences between types of schemas and specs. I think it would be better if we could have a short call and you can explain to me what you mean exactly. |
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
Seq(), | ||
ListMap( | ||
"resourceService" -> Seq(publicEndpointServiceName), | ||
"resourcePath" -> Seq(s"credential-definition-registry/definitions/${credentialDefinitionGUID.toString}/definition?resourceHash=$hash"), |
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.
Should the prefix cloud-agent
be added to the path?
It should be a matter of configuration, so the agent should know the full external path
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.
We don't need to add "cloud-agent" in the path. when we later construct an HTTP URL to resolve an actual resource from the DID URL, we will use resource service, which is going to be located inside the DID, we will resolve the did and this service will include the server base URL path, in the next ticket PR, when I add this service by default to every DID that issuer creates, the value of this service will be from the config, the value of public endpoint, and it does already include "cloud-agent" as you can see here
identus-cloud-agent/cloud-agent/service/server/src/main/resources/application.conf
Line 96 in 11ee9df
publicEndpointUrl = "https://host.docker.internal:8080/cloud-agent" |
.../hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryEndpoints.scala
Show resolved
Hide resolved
.../hyperledger/identus/pollux/credentialdefinition/CredentialDefinitionRegistryEndpoints.scala
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,10 @@ | |||
-- Create the enum type | |||
CREATE TYPE resolution_method_enum AS ENUM ('http', 'did'); |
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.
We need to rename did
to did:prism
as this resolution method is our domestic specification. What do you think, @shotexa ?
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'm not sure, when I created this enum I meant which type of URL to use, and the schema for either one is did
or http
, If I rename did to did:prism
, this maybe assumes there might be did:somethingelse
in the future that is why I'm making this more specific in my database.
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.
Excellent work, @shotexa!
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
Signed-off-by: Shota Jolbordi <[email protected]>
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.
should we add validation to the PrismEnvelopeResponse code to incorporate validation logic for the resource and url fields in case the url doesn't conform to the DID url format or string not in the correct format. Error handling.
Signed-off-by: Shota Jolbordi <[email protected]>
Validate at which point? it is a response type, so we are returning it, if it were a type we received in a request we would validate it ofc, but since we are returning it, it is assumed to be valid as long as we are creating it correctly. If we are not creating it correctly, this case is covered by tests. |
Description:
Summarize the changes you're submitting in a few sentences, including Jira ticket ATL-xxxx if applicable.
Link to any discussion, related issues and bug reports to give the context to help the reviewer understand the PR.
Alternatives Considered (optional):
Link to existing ADR (Architecture Decision Record), if any. If relevant, describe other approaches explored and the selected approach. Documenting why the methods were not selected will create a knowledge base for future reference, helping prevent others from revisiting less optimal ideas.
Checklist: