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

(Feature): Add command and functionality to create a presentation definition #328

Closed
9 tasks
Tracked by #322
blackgirlbytes opened this issue Aug 29, 2024 · 4 comments · Fixed by #398
Closed
9 tasks
Tracked by #322

(Feature): Add command and functionality to create a presentation definition #328

blackgirlbytes opened this issue Aug 29, 2024 · 4 comments · Fixed by #398

Comments

@blackgirlbytes
Copy link
Contributor

🚀 Goal

Add a new command to the Web5 Rust CLI that allows users to create a presentation definition.

🔑 Tasks

  • Create a new command for creating presentation definitions (e.g., web5 pd create)
  • Implement the logic to generate a basic presentation definition structure
  • Add options to specify input descriptors, format, etc.
  • Implement validation to ensure created presentation definitions are valid
  • Add appropriate documentation for the new command
  • Provide examples of how to use the command with various options
  • Write tests to ensure the feature works correctly
  • Update the CLI's help information to include the new command
  • For more complex structures or large Presentation Definitions, consider adding an option to read from a JSON file.

Example

This is not exact or tested, but an idea of what it could look like

web5 pd create Command Structure

Basic Usage

web5 pd create <id> [options]

Options

  • --name <name>: Set the name of the Presentation Definition
  • --purpose <purpose>: Set the purpose of the Presentation Definition
  • --input-descriptor <descriptor>: Add an input descriptor (can be used multiple times)
    • Format: id:name:purpose
  • --field <field>: Add a field to the last input descriptor (can be used multiple times)
    • Format: id:name:path:purpose:optional:predicate
    • path should be a comma-separated list of strings
    • optional should be "true" or "false"
    • predicate should be "required" or "preferred"
  • --filter <filter>: Add a filter to the last field (can be used multiple times)
    • Format: type:pattern:const_value
  1. Create a basic Presentation Definition:
web5 pd create my-pd-1 --name "Basic PD" --purpose "Verification"
  1. Create a Presentation Definition with an input descriptor:
web5 pd create my-pd-2 --name "PD with Descriptor" --purpose "Identity Check" --input-descriptor "input-1:Personal Info:Verify personal information"
  1. Create a complex Presentation Definition:
web5 pd create my-pd-3 \
  --name "Complex PD" \
  --purpose "Comprehensive Verification" \
  --input-descriptor "input-1:Personal Info:Verify personal information" \
  --field "field-1:Name:$.credentialSubject.name:Verify name:false:required" \
  --filter "string:^[A-Za-z ]+$" \
  --field "field-2:Age:$.credentialSubject.age:Verify age:true:preferred" \
  --filter "number:^[0-9]+$" \
  --input-descriptor "input-2:Address:Verify address" \
  --field "field-3:Street:$.credentialSubject.address.street:Verify street:false:required"

🌟 Resources

⚡ Getting Started

  1. Comment ".take" on this issue to get assigned
  2. Fork the repository and create a new branch for this task
  3. Update the documentation as described in the tasks
  4. Submit a pull request with your changes
  5. Respond to any feedback during the review process

💭 Questions?

If you have any questions or need clarification, please comment on this issue or join our Discord community.
Happy coding! 🎉

@w3irdrobot
Copy link
Contributor

.take

Copy link

github-actions bot commented Oct 8, 2024

Thanks for taking this issue! Let us know if you have any questions!

@taniashiba
Copy link
Contributor

Hi @w3irdrobot - wanted to check in and see if you had any questions ❤

@w3irdrobot
Copy link
Contributor

yep. still hacking away on it. I have some other stuff I'm spreading my time out on as well. this particular ticket is deceiving because position dependent flags are not really in clap by default. but I think I know a way to accomplish it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants