-
Notifications
You must be signed in to change notification settings - Fork 65
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
Support Groups with multiple credentials and logical operators #530
Conversation
Now Bandada supports groups with multiple credentials using logical operators. re #223
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Brilliant work! It's really tidy <3
Just a thought: we should open a PR to add more tests to cover more edge cases (like using parenthesis, large numbers of credentials, and so on). Otherwise, it looks great!
Hey @0xjei thank you very much for reviewing it. I will add a couple of new test cases. |
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.
amazing, tysm for adding these cases!
Description
This PR adds support for groups with multiple credentials and logical operators.
Related Issue
Closes #223
Does this introduce a breaking change?
Other information
Information about groups with many credentials
A user can use the Dashboard app or API to create a group with many credentials.
This is the structure of a credential group with only one credential
Example:
This is the structure of a credential group with multiple credentials:
Example:
The user will be able to join a credential group by using a URL like this:
Example:
Then the user will be asked to prove all the credentials.
Since checking credentials require using different URLs under the hood, the main user data to later check the credentials will be saved in local storage. It's removed when all the values are completed.
The local storage will look like this:
Example:
Some information about the implementation
The expression property, in the credentials' property in a multiple credential group, is an array with strings. Every position will have an empty string or a string with a logical operator. Every empty string represents a credential. Then the first empty string represents the first credential in the list of credentials, the second empty string represents the second credential in the list of credentials and so on.
If for example, we have something like:
The expression that will be evaluated is:
credential1 and credential2
.After all the credentials are evaluated, we will have true or false for every one of them and then we will have an expression like:
["true", "and", "true"]
in case credential1 and credential2 both evaluate to true.Then the logical expression will be evaluated using the
Shunting Yard
algorithm adapted to evaluate expressions with logical operators.