-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
types.ts
58 lines (50 loc) · 1.35 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { AuthPasswordlessDeliveryDestination, ClientMetadata } from "../../types/models";
/**
* Payload sent to the backend when creating a user.
*/
export type PasswordlessSignUpPayload = {
destination: AuthPasswordlessDeliveryDestination;
email?: string;
phone_number?: string;
username: string;
}
/**
* Payload sent to the backend when signing a user in.
*/
export type PasswordlessSignInPayload = ({
signInMethod: 'MAGIC_LINK';
destination: Extract<AuthPasswordlessDeliveryDestination, "EMAIL">;
} | {
signInMethod: 'OTP';
destination: AuthPasswordlessDeliveryDestination;
}) & {
username: string;
clientMetadata?: ClientMetadata;
}
export type PreInitiateAuthPayload = {
/**
* Optional fields to indicate where the code/link should be delivered.
*/
email?: string;
phone_number?: string;
username: string;
/**
* Any optional user attributes that were provided during sign up.
*/
userAttributes?: { [name: string]: string | undefined };
/**
* The delivery medium for passwordless sign in. For magic link this will
* always be "EMAIL". For OTP, it will be the value provided by the customer.
*/
deliveryMedium: string;
/**
* The user pool ID
*/
userPoolId: string;
/**
* The user pool region
*/
region: string;
};