-
Notifications
You must be signed in to change notification settings - Fork 19
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: allow any credentialStatus for oa v4 #315
feat: allow any credentialStatus for oa v4 #315
Conversation
Removing restriction for credetialStatus
Hi @nghaninn , Thanks for the suggestion. May we clarify what are some other type values of This is because adding As a result, an object like this would pass incorrectly: "credentialStatus": {
// id: "MISSING_ID",
type: "OpenAttestationOcspResponder"
} The |
Hi @HJunyuan. We wanted to add a new type for TransferableRecords, such that the object will be like credentialStatus: {
type: "TransferableRecords",
id: "0xb1767E3B31A286b051684CdBe0447FBd483D71A7",
tokenNetwork: {
chain: "Amoy",
chainId: 80002
},
tokenRegistry: "0xb1767E3B31A286b051684CdBe0447FBd483D71A7"
}, Understand the strict enforcement. Will the below worth within the constraint? with additional @context export const TransferableRecords = z.object({
id: z.string().url().describe("Address of smart contract "),
type: z.literal("TransferableRecords"),
tokenNetwork: z.object({
chainId: z.number(),
chain: z.string(),
}).passthrough(),
tokenRegistry: z.string(),
}).passthrough();
...
credentialStatus: z.discriminatedUnion("type", [OscpResponderRevocation, RevocationStoreRevocation, TransferableRecords]).optional(), |
After further discussions with the team, we would suggest the following snippet as a first solution to meet your current needs. This would continue to make it strict for known credentialStatus types that are defined by us. Otherwise, we won't enforce the schema: const Others = z.object({ type: z.string() }).passthrough();
credentialStatus: z.discriminatedUnion("type", [
OscpResponderRevocation,
RevocationStoreRevocation,
Others,
]).optional(); This discussion has also made us rethink how we can overhaul our OA library to support the issuance of more generic VCs and provide the flexibility to mix and match different securing mechanisms/render methods/etc., whether from OA or outside OA. Here are some possible changes we are exploring. Let's start by defining:
Since most of our users will be using OA framework as is, we will still like to provide a high-level method to produce documents that are strictly OA data model v4:
We do however want to support users who wish to pick only a subset of OA features, hence we are looking at something like:
And allow any W3C VC to be secured with our securing mechanism:
We also can provide these utilities/guards:
We envision that in TrustVC: vc = createVC(payload)
vc-with-oa-render-method = addOARenderMethod(vc)
bbs-secured-vc-with-oa-render-method = bbsSign(vc-with-oa-render-method) We are open to suggestions. |
Hi @HJunyuan and team, On the exploration front, we've got plans to simplify schema generation and signing with a |
Hi @HJunyuan, Pardon me, it seems like we can't have credentialStatus: z.discriminatedUnion("type", [OscpResponderRevocation, RevocationStoreRevocation, Others]).optional(), This results in an error when generating the schema.
An example also illustrated in this discussion. colinhacks/zod#2747 After some research, I think that union type is the best option, which leads to a simpler schema:
Schema Output
Some Reference: The alternative generate rather complex schema
credentialStatus: z
.discriminatedUnion("type", [OscpResponderRevocation, RevocationStoreRevocation])
.or(Others)
.optional(), OR credentialStatus: OscpResponderRevocation
.or(RevocationStoreRevocation)
.or(Others)
.optional(), Schema Output
Let me know your thoughts. Thanks. |
Hi @HJunyuan and team, Thank you for meeting with the team. I appreciate your clarification on the constraints surrounding the OA default schema, specifically the limitation to only support two credentialStatus types for now, with a promise to revisit and potentially expand to more generic schema in the future. I also appreciate the heads up on upcoming breaking changes. I will proceed with closing this PR for now, and I look forward to receiving more information regarding the roadmap for OA v4. This will help us make an informed decision about making TradeTrust compatible. Please keep me updated, and thank you again for your time and consideration. |
Hi @nghaninn and team, We have recently raised another PR (#317) to allow both OA and W3C VCs to be digested (previously known as wrapped) or signed. Please note the changes in the PR description such as:
Do give the branch a try to see if it resolves what you wanted to achieve with a custom |
Summary
What is the background of this pull request?
Changes
What are the changes made in this pull request?
Issues
What are the related issues or stories?
Happy to have a discussion for any suggestion.