-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1bdf7f7
commit ca11717
Showing
47 changed files
with
1,194 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: | | ||
Access token used to make requests. Short lived, should be refreshed with the `refreshToken` when it expires (`expiresAt`). | ||
type: string | ||
examples: | ||
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: User's email | ||
type: string | ||
format: email | ||
examples: | ||
- [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
description: | | ||
Expiration date of the `accessToken` | ||
type: string | ||
format: date-time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
description: User's complete phone number, including country code | ||
type: string | ||
examples: | ||
- '+5511999999999' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: | | ||
Long lived token, used to generate other `accessToken`s | ||
type: string | ||
examples: | ||
- 'ZBwidKKKfaCayu6bajbG066Tu49b6uSaVBtTKcek2Gp6lje7Zt0RCT9B6I2Azu6f' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
description: User's timezone | ||
type: string | ||
enum: | ||
- America/Araguaina | ||
- America/Bahia | ||
- America/Belem | ||
- America/Boa_Vista | ||
- America/Campo_Grande | ||
- America/Cuiaba | ||
- America/Eirunepe | ||
- America/Fortaleza | ||
- America/Maceio | ||
- America/Manaus | ||
- America/Noronha | ||
- America/Porto_Velho | ||
- America/Recife | ||
- America/Rio_Branco | ||
- America/Santarem | ||
- America/Sao_Paulo |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
type: object | ||
title: Auth Response Content | ||
title: Auth response content | ||
required: | ||
- accessToken | ||
- refreshToken | ||
- expiresAt | ||
properties: | ||
accessToken: | ||
description: | | ||
Access token used to make requests. Short lived, should be refreshed with the `refreshToken` when it expires (`expiresAt`). | ||
type: string | ||
examples: | ||
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" | ||
$ref: ../fields/access-token.yaml | ||
refreshToken: | ||
description: | | ||
Long lived token, used to generate other `accessToken`s | ||
type: string | ||
examples: | ||
- "ZBwidKKKfaCayu6bajbG066Tu49b6uSaVBtTKcek2Gp6lje7Zt0RCT9B6I2Azu6f" | ||
$ref: ../fields/refresh-token.yaml | ||
expiresAt: | ||
description: | | ||
Expiration date of the `accessToken` | ||
type: string | ||
format: date-time | ||
$ref: ../fields/expires-at.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type: object | ||
title: Auth with Third Party Provider | ||
required: | ||
- code | ||
- timezone | ||
properties: | ||
code: | ||
description: Code returned by the auth provider | ||
type: string | ||
examples: | ||
- example | ||
originUrl: | ||
description: The origin of this request, same url used for `redirect_uri` | ||
type: string | ||
format: url | ||
examples: | ||
- https://example.com/google | ||
timezone: | ||
$ref: ../fields/timezone.yaml |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,14 @@ post: | |
title: Auth with email | ||
required: | ||
- timezone | ||
properties: | ||
email: | ||
description: User's email | ||
type: string | ||
format: email | ||
examples: | ||
- [email protected] | ||
$ref: ../../components/fields/email.yaml | ||
timezone: | ||
$ref: ../../components/fields/timezone.yaml | ||
required: true | ||
responses: | ||
"201": | ||
'204': | ||
description: | | ||
A magic link was sent to the user's email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
post: | ||
tags: | ||
- Auth | ||
summary: Refresh `accessToken` | ||
description: | | ||
Refresh `accessToken` | ||
operationId: auth-refresh | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
title: Refresh `accessToken` | ||
required: | ||
- refreshToken | ||
properties: | ||
refreshToken: | ||
$ref: ../../components/fields/refresh-token.yaml | ||
required: true | ||
responses: | ||
'200': | ||
description: | | ||
Refresh succeeded | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
title: Refresh response content | ||
required: | ||
- accessToken | ||
- expiresAt | ||
properties: | ||
accessToken: | ||
$ref: ../../components/fields/access-token.yaml | ||
expiresAt: | ||
$ref: ../../components/fields/expires-at.yaml | ||
|
||
'400': | ||
description: | | ||
Invalid refresh token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import { AccountEntity } from 'src/models/account'; | ||
|
||
export interface SendInput { | ||
from: string; | ||
to: string; | ||
title: string; | ||
body: string; | ||
account: AccountEntity; | ||
templateId: keyof typeof EMAIL_TEMPLATES; | ||
placeholders: Record<string, string | number>; | ||
} | ||
|
||
export const EMAIL_TEMPLATES = { | ||
MAGIC_LINK_LOGIN: { | ||
from: '', | ||
title: '', | ||
body: '', | ||
}, | ||
}; | ||
|
||
export interface EmailAdapter { | ||
send: (i: SendInput) => Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export interface ExchangeCodeInput { | ||
code: string; | ||
originUrl: string; | ||
} | ||
|
||
export interface ExchangeCodeOutput { | ||
scopes: Array<string>; | ||
accessToken: string; | ||
refreshToken: string; | ||
expiresAt: Date; | ||
} | ||
|
||
export interface GetAuthenticatedUserDataOutput { | ||
id: string; | ||
name: string; | ||
email: string; | ||
isEmailVerified: boolean; | ||
} | ||
|
||
export abstract class GoogleAdapter { | ||
readonly requiredScopes = ['openid', 'profile', 'email']; | ||
|
||
abstract exchangeCode(i: ExchangeCodeInput): Promise<ExchangeCodeOutput>; | ||
|
||
abstract getAuthenticatedUserData( | ||
accessToken: string, | ||
): Promise<GetAuthenticatedUserDataOutput>; | ||
} |
Oops, something went wrong.