Skip to content
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

Bare minimum presentation definition types #134

Merged
merged 4 commits into from
Apr 5, 2024
Merged

Conversation

mistermoe
Copy link
Contributor

@mistermoe mistermoe commented Apr 5, 2024

Changes

Added bare minimum presentation definition types needed for tbdex

Usage

pd := PresentationDefinition{
    InputDescriptors: []InputDescriptor{
        {
            Constraints: Constraints{
                Fields: []Field{
                    {
                        Path: []string{"$.credentialSchema[*].id"},
                        Filter: Filter{
                            Type:  "string",
                            Const: "https://schemas.tbdex.dev/KnownCustomerCredential"
                            
                        },
                    },
                    {
                        Path: []string{"$.issuer"},
                        Filter: Filter{
                            Type:  "string",
                            Const: "PFI_DID",
                        },
                    },
                },
            },
        },
    },
}

Added vc.credentialSchema and respective create option

Note

currently defaults credentialSchema.type to JsonSchema

Important

validation using these JSON Schemas will be added in a subsequent PR

Usage

claims := vc.Claims{"id": "1234"}
issuanceDate := time.Now().UTC().Add(10 * time.Hour)
expirationDate := issuanceDate.Add(30 * time.Hour)

cred := vc.Create(
    claims,
    vc.ID("hehecustomid"),
    vc.Contexts("https://nocontextisbestcontext.gov"),
    vc.Types("StreetCredential"),
    vc.IssuanceDate(issuanceDate),
    vc.ExpirationDate(expirationDate),
    vc.Schemas("https://example.org/examples/degree.json"),
)

@KendallWeihe
Copy link
Contributor

validation using these JSON Schemas will be added in a subsequent PR

FYI #131

pexv2/pd.go Outdated Show resolved Hide resolved
pexv2/pd.go Outdated
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Purpose string `json:"purpose,omitempty"`
Format string `json:"format,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format is an object no? are you in move fast and break things mode here? if so could you create a ticket to correct in a follow up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on this same note, missing format in the InputDescriptor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also fields.optional and constraints.limit_disclosure

I'm guessing all of this was intentionally left out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye intentionally left out as it's not needed at the moment. Felt this was better than map[string]any on the tbdex side

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KendallWeihe : removed format for now! 9b78e78

Copy link
Contributor

@KendallWeihe KendallWeihe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few comments on type definitions but lgtm ✅

mistermoe and others added 2 commits April 5, 2024 10:44
@mistermoe mistermoe merged commit 0cf8b37 into main Apr 5, 2024
3 checks passed
@mistermoe mistermoe deleted the presentation-definition branch April 5, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants