Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Feb 3, 2025

Also tested it in the example app by removing the sessionToken from the localstorage.

@nikgraf nikgraf self-assigned this Feb 3, 2025
@nikgraf nikgraf force-pushed the ng/move-login-with-keys branch from 68d8a05 to 202a617 Compare February 3, 2025 21:26
@nikgraf nikgraf changed the title move loginWithKeys function to core and add tests fixed loginWithKeys function and moved it to core + add tests Feb 3, 2025
}

const account = privateKeyToAccount(keys.signaturePrivateKey as Hex);
const sessionNonce = await getSessionNonce(accountId, syncServerUri);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch here, I hadn't realized we were using the wrong account ID

if (url.toString() === 'http://localhost:3000/whoami') {
return Promise.resolve({
status: 200,
text: () => Promise.resolve(accountId),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this actually testing with a valid existing token? Shouldn't this return a different account ID or an error to test the case of an invalid token? (Unless I'm missing something)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spot on! fixed the test

@nikgraf nikgraf merged commit c87f0c2 into main Feb 4, 2025
4 checks passed
@nikgraf nikgraf deleted the ng/move-login-with-keys branch February 4, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants