Skip to content

Commit

Permalink
waas: return email in SignInResponse (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav committed Jun 6, 2024
1 parent 4d820d7 commit 6e0643f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/waas/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export type Identity = {
idToken: string
}

export type SignInResponse = {
sessionId: string,
wallet: string,
email?: string,
}

function encodeHex(data: string | Uint8Array) {
return (
'0x' +
Expand Down Expand Up @@ -215,7 +221,7 @@ export class SequenceWaaS {
return this.waas.isSignedIn()
}

async signIn(creds: Identity, name: string): Promise<{ sessionId: string; wallet: string }> {
async signIn(creds: Identity, name: string): Promise<SignInResponse> {
// TODO: Be smarter about this, for cognito (or some other cases) we may
// want to send the email instead of the idToken
const signInIntent = await this.waas.signIn({
Expand Down Expand Up @@ -244,7 +250,8 @@ export class SequenceWaaS {

return {
sessionId: res.session.id,
wallet: res.response.data.wallet
wallet: res.response.data.wallet,
email: res.session.identity.email,
}
} catch (e) {
await this.waas.completeSignOut()
Expand Down

0 comments on commit 6e0643f

Please sign in to comment.