Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Fixed tokenStorageGet and authenticateExistingSession#11

Open
Nomad1556 wants to merge 1 commit intorootfrom
fix-storage
Open

Fixed tokenStorageGet and authenticateExistingSession#11
Nomad1556 wants to merge 1 commit intorootfrom
fix-storage

Conversation

@Nomad1556
Copy link
Copy Markdown
Contributor

to account for when the token file does not exist

to account for when the token file does not exist
fun authenticateExistingSession(): Boolean {
val (token, date, integrity, _) = tokenStorageGet().split(";")
val storedToken = tokenStorageGet()
if (storedToken == "") return false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have it written as the following to be more clear as to what we're checking:

if (storedToken.isEmpty())
    return false

val fileContent = Files.readAllLines(Path.of(getAbsolutePath()))
return fileContent[2]
} catch (e: IOException) {
return ""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be sure to add documentation on this so we know it returns an empty string if the token couldn't be parsed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants