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

Generic type payload and ext access #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Ddiidev
Copy link

@Ddiidev Ddiidev commented Feb 10, 2024

I made the payload generic to make it more practical to use the ext, which I also left public property, to be able to access the field.

The only problem there is the fact that it is not possible to compare a token, e.g. token1 == token2

This is because the compiler has an error in operator overloading, I opened an issue for this

vlang/v#20777

@enghitalo
Copy link

Tem uma forma melhor the fazer isso aqui tbm. sem precisar usar .bytes()) você só precisar adicionar o o encoder e fazer o encode e pegar o bufer pulando a etapa de transformar o buffer em string

	header := base64.url_encode(json.encode[Header](Header{}).bytes())
	payload_string := base64.url_encode(json.encode[Payload](payload).bytes())

Me lembre de por o código aqui

@Ddiidev
Copy link
Author

Ddiidev commented Feb 17, 2024

Tem uma forma melhor the fazer isso aqui tbm. sem precisar usar .bytes()) você só precisar adicionar o o encoder e fazer o encode e pegar o bufer pulando a etapa de transformar o buffer em string

	header := base64.url_encode(json.encode[Header](Header{}).bytes())
	payload_string := base64.url_encode(json.encode[Payload](payload).bytes())

Me lembre de por o código aqui

Manda a boa, joga esse código no peito do pai.

This change is because json2 doesn't handle complex objects well.
But in this case, a problem is that cjson does not deal with the Time type, so an alias for string is being used
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.

None yet

2 participants