Skip to content

Rewrite privilage token middleware to be more efficent and use big.Int#90

Draft
KevinJoiner wants to merge 3 commits intomainfrom
priv-token
Draft

Rewrite privilage token middleware to be more efficent and use big.Int#90
KevinJoiner wants to merge 3 commits intomainfrom
priv-token

Conversation

@KevinJoiner
Copy link
Contributor

Refactor the privilege token middle ware because I was in there to fix big.Int and some other parts bothered me

  1. Update token_id to be big.Int instead of string
  2. Add a function for that requires all privileges to be met not just one of
  3. Move Contract Address to middleware constructor
  4. Remove wrapping interface
  5. Remove double token unmarshal.
  6. Remove some of the random classes from test

type CustomClaims struct {
ContractAddress common.Address `json:"contract_address"`
TokenID string `json:"token_id"`
TokenID *big.Int `json:"token_id"`
Copy link
Member

Choose a reason for hiding this comment

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

note: On the face of it, this is not backwards-compatible and probably dangerous in JS environments.

On the other hand we don't have any JS code that reads this right now and the tokens don't last very long. But we'd want to roll out upgrades to all affected services fairly quickly. (Or support both formats somehow).

}
if claims.ContractAddress != v.Contract {
logger.Debug().
Uint64(logfields.VehicleTokenID, tokenID.Uint64()).
Copy link
Member

Choose a reason for hiding this comment

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

But this is not necessarily a vehicle.

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