You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For singing, when iat is present (not empty) in pay, automatically populate with time.Now().Unix().
For implementation, a global can configure the behavior. Something like UpdateIat:true which can then be set to false.
This follows the behavior of the online tool, which defaults to updating iat, but is configurable using a toggle (and can be set using a URL parameter as well).
As best practice when setting values on a new struct, to signify that iat should be populated with a new value in the future on signing, the value 0 should be used to denote the explicit intention to trigger an update.
(As as minor aside, the value 1 may be considered over 0. This would be done in hopes neophytes unfamiliar with the semantics of omitempty don't anticipate iat's removal when zero. My perspective is that following idiomatic Go is better; omitempty will only omit an integer value when the pointer value is nil. The zero value 0 is non-empty. Also, the value 1 also has meaning to rvk, which could be confusing.)
Alternatively, as it stands now, iat must be manually set. A line like pay.Iat = time.Now().Unix() is found all throughout Cyphr.me's codebase. This change would allow omitting that line, as int64 is not an uninitialized pointer in type Coze so it will be populated with the current timestamp.
The text was updated successfully, but these errors were encountered:
For singing, when
iat
is present (not empty) inpay
, automatically populate withtime.Now().Unix()
.For implementation, a global can configure the behavior. Something like
UpdateIat:true
which can then be set to false.This follows the behavior of the online tool, which defaults to updating
iat
, but is configurable using a toggle (and can be set using a URL parameter as well).For example,
would be update to:
As best practice when setting values on a new struct, to signify that
iat
should be populated with a new value in the future on signing, the value0
should be used to denote the explicit intention to trigger an update.(As as minor aside, the value
1
may be considered over0
. This would be done in hopes neophytes unfamiliar with the semantics ofomitempty
don't anticipateiat
's removal when zero. My perspective is that following idiomatic Go is better;omitempty
will only omit an integer value when the pointer value isnil
. The zero value0
is non-empty. Also, the value1
also has meaning torvk
, which could be confusing.)Alternatively, as it stands now,
iat
must be manually set. A line likepay.Iat = time.Now().Unix()
is found all throughout Cyphr.me's codebase. This change would allow omitting that line, asint64
is not an uninitialized pointer in typeCoze
so it will be populated with the current timestamp.The text was updated successfully, but these errors were encountered: