Skip to content

Commit

Permalink
fix: decode auth request param
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi committed Oct 26, 2023
1 parent 191166d commit 6ef4bf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion frontend/app/webauth/[requestCode]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ export default function WebAuth({ params }: { params: { requestCode: string } })

useEffect(() => {
const validateWebAuthRequest = async () => {
const decodedWebAuthReq = await cryptoUtils.decodeb64string(params.requestCode)
const decodedWebAuthReq = await cryptoUtils.decodeb64string(
decodeURIComponent(params.requestCode)
)
const authRequestParams = getWebAuthRequestParams(decodedWebAuthReq)

if (!authRequestParams.publicKey || !authRequestParams.requestedTokenName)
Expand Down
4 changes: 2 additions & 2 deletions frontend/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ export namespace cryptoUtils {
return `${hostname}/invite/${encodedInvite}`
}

export const decodeb64string = async (hash: string) => {
export const decodeb64string = async (b64string: string) => {
await _sodium.ready
const sodium = _sodium

return sodium.to_string(sodium.from_base64(hash, sodium.base64_variants.ORIGINAL))
return sodium.to_string(sodium.from_base64(b64string, sodium.base64_variants.ORIGINAL))
}

export const getKeyring = async (email: string, organisationId: string, password: string) => {
Expand Down

0 comments on commit 6ef4bf4

Please sign in to comment.