-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #1489 from ThatConference/feat/add-svelte-auth
Feat/add svelte auth
Showing
39 changed files
with
1,720 additions
and
2,977 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// JWT parsing | ||
|
||
// Decodes jwt payload, doesn't validate signature | ||
export const parseOnly = (jwt) => { | ||
let base64Payload; | ||
if (jwt?.split) { | ||
[, base64Payload] = jwt?.split('.') ?? []; | ||
} | ||
let jsonPayload = null; | ||
if (base64Payload) { | ||
jsonPayload = Buffer.from(base64Payload, 'base64').toString('utf8'); | ||
} | ||
let payload = null; | ||
if (typeof jsonPayload === 'string') { | ||
payload = JSON.parse(jsonPayload); | ||
} | ||
|
||
if (payload?.sub) { | ||
return payload; | ||
} | ||
|
||
return null; | ||
}; |
Oops, something went wrong.