Skip to content

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.

Ddiidev and others added 3 commits February 19, 2024 10:23
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
Changed import of 'time' to import the whole module instead of just 'Time'. Updated JsTime's time() method to use 'time.Time' type and improved error handling by using 'return none'. Minor formatting adjustments for consistency.
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