This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using:
This file contains 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
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.4.22 <0.9.0; | |
library console { | |
address constant CONSOLE_ADDRESS = | |
0x000000000000000000636F6e736F6c652e6c6f67; | |
function _sendLogPayloadImplementation(bytes memory payload) internal view { | |
address consoleAddress = CONSOLE_ADDRESS; | |
/// @solidity memory-safe-assembly |