Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passkey_fixed #198

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
passkey_fixed
dzlk17 committed Aug 27, 2024
commit 208a32c301235625f935a96971b25ca1807b2ac5
2 changes: 1 addition & 1 deletion sdk/packages/cloud/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nightlylabs/nightly-cloud",
"version": "0.0.9",
"version": "0.0.13",
"type": "module",
"exports": {
".": {
26 changes: 22 additions & 4 deletions sdk/packages/cloud/src/app.ts
Original file line number Diff line number Diff line change
@@ -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
}

@@ -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
}

@@ -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
}
@@ -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
}
@@ -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