Skip to content

Commit

Permalink
fix: remove redundancy function
Browse files Browse the repository at this point in the history
  • Loading branch information
truongnhatquang21 committed Dec 10, 2024
1 parent 7cbf961 commit 591605e
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions packages/waypoint/web/delegation-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,10 @@ export const delegationAuthorize = async <T extends DelegationAuthorizeOpts>(
} as DelegationAuthorizeData<T>
}

const parseClientShard = async () => {
const url = new URL(window.location.href)

const method = url.searchParams.get("method")
if (method !== "auth") {
throw "parseRedirectUrl: invalid method"
}

const type = url.searchParams.get("type")
if (type !== "success") {
throw "parseRedirectUrl: authorization failed"
}
export const parseRedirectUrlWithShard = async () => {
const authData = parseRedirectUrlForAuthData()

const url = new URL(window.location.href)
const encryptedShard = url.searchParams.get("wallet_key")

if (!encryptedShard) {
Expand All @@ -111,14 +102,6 @@ const parseClientShard = async () => {
const builtPrivateKey = await buildPrivateKey(privateKey)
const clientShard = await decryptClientShard(encryptedShard, builtPrivateKey)

return {
clientShard,
}
}

export const parseRedirectUrlWithShard = async () => {
const authData = parseRedirectUrlForAuthData()
const { clientShard } = await parseClientShard()
return {
...authData,
clientShard,
Expand Down

0 comments on commit 591605e

Please sign in to comment.