-
Notifications
You must be signed in to change notification settings - Fork 31
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: use same issuer for monthly and annual products #2654
Conversation
given: []byte(`{"sku":"sku","merchantId":"merchantId"}`), | ||
exp: tcExpected{ | ||
errFn: func(tt must.TestingT, err error, i ...interface{}) { | ||
must.Equal(tt, true, err != nil) |
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.
Same as above, would using must.NotNil(tt, err)
not be more concise?
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.
Same reasoning as here.
}, | ||
}, | ||
errFn: func(tt must.TestingT, err error, i ...interface{}) { | ||
must.Equal(tt, true, err == nil) |
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.
question: would using must.Nil(tt, err)
be more concise?
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.
Same reasoning as here.
Now the blocking comment and conflicts have been resolved, happy to approve. Left a few non blocking responses to your comments. |
[puLL-Merge] - brave-intl/bat-go@2654 DescriptionThis PR refactors the credential verification process in the SKUs service, improving code organization, error handling, and type safety. It also introduces new validation and parsing functions for credential requests. ChangesChanges
Possible Issues
Security Hotspots
Overall, this PR appears to improve the code structure and type safety of the credential verification process. The changes seem well-tested and follow good coding practices. The main points to consider are the potential impact of the SKU normalization change and ensuring proper input validation throughout the new parsing and validation functions. |
Summary
This PR changes the way SKU values are used when interacting with CBP in such a way as to make sure that each Premium product pair (monthly and annual) uses the same issuer.
Currently, Premium products have SKU values in the format of
brave-[name]-premium
. Annual products will temporarily have SKUs likebrave-[name]-premium-year
. Although eventually variants of the same product will use the same SKU, until that happened we need a way to make sure the same issuer is used for signing and verifying credentials.This is accomplished by trimming the
-year
suffix from SKU values in places where they are sent to CBP.Additionally, this PR offers some refactoring and improvements to the verify credential endpoints.
Type of Change
Tested Environments
Before Requesting Review
Manual Test Plan