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

Update register to make email optional #394

Merged
merged 2 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

#### Features

- Adds app owned WNFS.
- Adds app owned WNFS
- Separates initialize into app and permissionedApp entrypoints
- Make email optional at registration

### v0.32.0

Expand Down
2 changes: 1 addition & 1 deletion src/auth/implementation/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const init = async (): Promise<AppState | null> => {
return new Promise((resolve) => resolve(null))
}

export const register = async (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = async (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
const { success } = await createAccount(options)

if (success) {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/implementation/lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const init = async (options: PermissionedAppInitOptions): Promise<Permiss
return null
}

export const register = async (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = async (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
return new Promise(resolve => resolve({ success: false }))
}

Expand Down
2 changes: 1 addition & 1 deletion src/auth/implementation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Channel, ChannelOptions } from "../../auth/channel"

export type Implementation = {
init: (options: InitOptions) => Promise<State | null>
register: (options: { email: string; username: string }) => Promise<{ success: boolean }>
register: (options: { username: string; email?: string }) => Promise<{ success: boolean }>
isUsernameValid: (username: string) => Promise<boolean>
isUsernameAvailable: (username: string) => Promise<boolean>
createChannel: (options: ChannelOptions) => Promise<Channel>
Expand Down
2 changes: 1 addition & 1 deletion src/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { impl } from "./implementation.js"

export const register = async (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = async (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
return impl.register(options)
}

Expand Down
2 changes: 1 addition & 1 deletion src/auth/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const init = (options: InitOptions): Promise<State | null> => {
return authLobby.init(options)
}

export const register = (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
return authLobby.register(options)
}

Expand Down
2 changes: 1 addition & 1 deletion src/lobby/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export * from "./username.js"
*/
export async function createAccount(
userProps: {
email: string
username: string
email?: string
}
): Promise<{ success: boolean }> {
const apiEndpoint = setup.getApiEndpoint()
Expand Down