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
The documentation for Signed Global IDs shows that they can have an expiry date. I know that if the SGID is expired, then trying to use it to locate a record returns nil. But returning nil could also mean that the record indicated by the SGID no longer exists.
Is there a way to specifically tell that the SGID is expired? I see in the code, an ExpiredMessage exception is actually raised, but it is immediately caught and turned into nil.
I could use the SignedGlobalID#verifier to decode the message and then get the expired_at attribute out of the Hash. That seems hacky to me, so I was wondering if there was another way to check for expiration?
Would a PR to add an expired? method to SignedGlobalID be welcome? I'd be happy to work on that.
Thanks!
The text was updated successfully, but these errors were encountered:
I'd be interested as well - we want to know if & when a globalid expired to show users an info like "this link expired on XXX". Currently we do this manually using SignedGlobalID.verifier. It would be great if an expires_at method could be added in addition to expired?.
The documentation for Signed Global IDs shows that they can have an expiry date. I know that if the SGID is expired, then trying to use it to locate a record returns
nil
. But returningnil
could also mean that the record indicated by the SGID no longer exists.Is there a way to specifically tell that the SGID is expired? I see in the code, an
ExpiredMessage
exception is actually raised, but it is immediately caught and turned intonil
.globalid/lib/global_id/signed_global_id.rb
Lines 32 to 40 in 3ddb0f8
I could use the
SignedGlobalID#verifier
to decode the message and then get theexpired_at
attribute out of the Hash. That seems hacky to me, so I was wondering if there was another way to check for expiration?Would a PR to add an
expired?
method toSignedGlobalID
be welcome? I'd be happy to work on that.Thanks!
The text was updated successfully, but these errors were encountered: