Skip to content

Commit

Permalink
WIP: 6da8aa9 fix analytics sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
dzlk17 committed Sep 3, 2024
2 parents 2b50268 + 1ad8eb7 commit c39fd49
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions sdk/packages/cloud/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ export class NightlyCloud {
EndpointType.Public,
request
)) as HttpRegisterWithPasskeyStartResponse

// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.challenge = Buffer.from(response.publicKey.challenge, 'base64')
// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.user.id = Buffer.from(response.publicKey.user.id, 'base64')
return response
}

Expand Down Expand Up @@ -266,7 +269,14 @@ export class NightlyCloud {
EndpointType.Public,
request
)) as HttpLoginWithPasskeyStartResponse

// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.challenge = Buffer.from(response.publicKey.challenge, 'base64')
if (response.publicKey.allowCredentials) {
response.publicKey.allowCredentials.forEach((c) => {
// @ts-expect-error Fixes in direct parsing of the response
c.id = Buffer.from(c.id, 'base64')
})
}
return response
}

Expand Down Expand Up @@ -337,6 +347,10 @@ export class NightlyCloud {
EndpointType.Public,
request
)) as HttpResetPasskeyStartResponse
// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.challenge = Buffer.from(response.publicKey.challenge, 'base64')
// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.user.id = Buffer.from(response.publicKey.user.id, 'base64')

return response
}
Expand All @@ -363,6 +377,10 @@ export class NightlyCloud {
EndpointType.Private,
{}
)) as HttpAddNewPasskeyStartResponse
// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.challenge = Buffer.from(response.publicKey.challenge, 'base64')
// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.user.id = Buffer.from(response.publicKey.user.id, 'base64')

return response
}
Expand Down Expand Up @@ -567,10 +585,10 @@ export class NightlyCloud {
EndpointType.Private
)) as HttpGetPasskeyChallengeResponse

// @ts-expect-error
// @ts-expect-error Fixes in direct parsing of the response
response.publicKey.challenge = Buffer.from(response.publicKey.challenge, 'base64')
response.publicKey.allowCredentials?.forEach((c) => {
// @ts-expect-error
// @ts-expect-error Fixes in direct parsing of the response
c.id = Buffer.from(c.id, 'base64')
})
return response
Expand Down

0 comments on commit c39fd49

Please sign in to comment.