Created
March 9, 2026 11:47
-
-
Save trycf/afda0bd2e17322835bd72ae34221db39 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfset timestamp = 1773056327> | |
| <!--<cfset epoch = createDateTime(1970,1,1,0,0,0)>--> | |
| <!-- Convert timestamp in seconds to CF date --> | |
| <!--<cfset convertedTs = dateAdd("s", timestamp, epoch)>--> | |
| <!-- Now you can add minutes, etc. --> | |
| <!--<cfset requestTime = dateAdd("n", 5, convertedTs)>--> | |
| <!--<cfset currentTime = now()>--> | |
| <!--<cfset timeDifference = abs(dateDiff("n", requestTime, currentTime))>--> | |
| <!--<cfoutput>--> | |
| <!--Converted Timestamp: #convertedTs#<br>--> | |
| <!--Time Difference (minutes): #timeDifference#--> | |
| <!--</cfoutput>--> | |
| <cfset rawKey = binaryDecode(application.jwtkey, "hex")> | |
| <cfset keySpec = createObject("java", "javax.crypto.spec.SecretKeySpec")> | |
| <cfset key = keySpec.init(rawKey, "HmacSHA512")> | |
| <cfset config = { | |
| "returnType": "struct" | |
| }> | |
| <cfset jwt = verifySignedJWT(token, key, config )> | |
| <cfdump var="#jwt#"> | |
| <cfset epoch = createDateTime(1970,1,1,0,0,0)> | |
| <cfset requestTime = dateAdd("s", timestamp, epoch)> | |
| <cfset currentTime = now()> | |
| <cfset timeDifference = dateDiff("n", requestTime, currentTime)> | |
| <cfoutput>#requestTime#</cfoutput> | |
| <cfoutput>#currentTime#</cfoutput> | |
| <cfoutput>#timedifference#</cfoutput> | |
| <cfoutput>#currenttime gt requesttime#</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment