@logto/connector-aws-ses 1.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +229 -0
- package/docs/config-template.json +37 -0
- package/lib/index.js +40823 -0
- package/lib/jest.config.d.ts +3 -0
- package/lib/src/constant.d.ts +2 -0
- package/lib/src/index.d.ts +3 -0
- package/lib/src/index.test.d.ts +1 -0
- package/lib/src/mock.d.ts +11 -0
- package/lib/src/types.d.ts +75 -0
- package/lib/src/utils.d.ts +6 -0
- package/logo.svg +6 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Silverhand
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# AWS direct mail connector
|
|
2
|
+
|
|
3
|
+
The official Logto connector for AWS connector for direct mail service.
|
|
4
|
+
|
|
5
|
+
Amazon SES邮件推送服务 Logto 官方连接器[中文文档](#aws-ses邮件连接器)
|
|
6
|
+
|
|
7
|
+
- [AWS direct mail connector](#aws-direct-mail-connector)
|
|
8
|
+
- [Get started](#get-started)
|
|
9
|
+
- [Configure a mail service in the AWS service console](#configure-a-mail-service-in-the-aws-service-console)
|
|
10
|
+
- [Register AWS account](#register-aws-account)
|
|
11
|
+
- [Create a identity](#create-a-identity)
|
|
12
|
+
- [Edit the JSON of the connector](#edit-the-json-of-the-connector)
|
|
13
|
+
- [Test the Amazon SES connector](#test-the-amazon-ses-connector)
|
|
14
|
+
- [Configure types](#configure-types)
|
|
15
|
+
- [AWS SES 邮件连接器](#aws-ses-邮件连接器)
|
|
16
|
+
- [开始上手](#开始上手)
|
|
17
|
+
- [在 AWS 服务控制台中配置一个邮件服务](#在-aws-服务控制台中配置一个邮件服务)
|
|
18
|
+
- [注册 AWS 帐号](#注册-aws-帐号)
|
|
19
|
+
- [创建发信身份](#创建发信身份)
|
|
20
|
+
- [编写连接器的 JSON](#编写连接器的-json)
|
|
21
|
+
- [测试 Amazon SES 邮件连接器](#测试-amazon-ses-邮件连接器)
|
|
22
|
+
- [配置类型](#配置类型)
|
|
23
|
+
|
|
24
|
+
## Get started
|
|
25
|
+
Amazon SES is a cloud email service provider that can integrate into any application for bulk email sending.
|
|
26
|
+
|
|
27
|
+
Logto team to call the Amazon Simple Email Service APIs, with the help of which Logto end-users can register and sign in to their Logto account via mail verification code (or in other words, passcode).
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Configure a mail service in the AWS service console
|
|
31
|
+
|
|
32
|
+
> 💡 **Tip**
|
|
33
|
+
>
|
|
34
|
+
> You can skip some sections if you have already finished.
|
|
35
|
+
|
|
36
|
+
### Register AWS account
|
|
37
|
+
|
|
38
|
+
Go to [AWS](https://aws.amazon.com/) and register an account.
|
|
39
|
+
|
|
40
|
+
### Create a identity
|
|
41
|
+
|
|
42
|
+
- Go to `Amazon Simple Email Service` Console
|
|
43
|
+
- Create an identity, choose one of the following options
|
|
44
|
+
- Create an domain
|
|
45
|
+
- Create an email address
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Edit the JSON of the connector
|
|
49
|
+
|
|
50
|
+
1. Click your username in the upper right corner of the Amazon console to enter `Security Credentials`. If you don't have one, create an `AccessKey` and save it carefully.
|
|
51
|
+
2. Complete the settings of the `Amazon Simple Email Service` connector:
|
|
52
|
+
- Use the `AccessKey ID` and `AccessKey Secret` obtained in step 1 to fill in `accessKeyId` and `accessKeySecret` respectively.
|
|
53
|
+
- `region`: Fill in the `region` field with the region of the identity you use to send mail.
|
|
54
|
+
- `emailAddress`: The email address you use to send mail, in the format of `Logto<noreply@logto.io>` or `<noreply@logto.io>`
|
|
55
|
+
|
|
56
|
+
the following parameters are optional; parameters description can be found in the [AWS SES API documentation](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html).
|
|
57
|
+
|
|
58
|
+
- `feedbackForwardingEmailAddress`
|
|
59
|
+
- `feedbackForwardingEmailAddressIdentityArn`
|
|
60
|
+
- `configurationSetName`
|
|
61
|
+
|
|
62
|
+
Here is an example of the JSON of the `Amazon SES` connector:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"accessKeyId": "<access-key-id>",
|
|
67
|
+
"accessKeySecret": "<access-key-secret>",
|
|
68
|
+
"region": "<region>",
|
|
69
|
+
"emailAddress": "<noreply@logto.io>",
|
|
70
|
+
"templates": [
|
|
71
|
+
{
|
|
72
|
+
"usageType": "SignIn",
|
|
73
|
+
"subject": "<sign-in-template-subject>",
|
|
74
|
+
"content": "<sign-in-template-content>"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"usageType": "Register",
|
|
78
|
+
"subject": "<register-template-subject>",
|
|
79
|
+
"content": "<register-template-content>"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"usageType": "ForgotPassword",
|
|
83
|
+
"subject": "<forgot-password-template-subject>",
|
|
84
|
+
"content": "<forgot-password-template-content>"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"usageType": "Continue",
|
|
88
|
+
"subject": "<continue-template-subject>",
|
|
89
|
+
"content": "<continue-template-content>"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"usageType": "Test",
|
|
93
|
+
"subject": "<test-template-subject>",
|
|
94
|
+
"content": "<test-template-content>"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Test the Amazon SES connector
|
|
102
|
+
|
|
103
|
+
You can type in an email address and click on "Send" to see whether the settings work before "Save and Done".
|
|
104
|
+
|
|
105
|
+
That's it. Don't forget to [Enable connector in sign-in experience](https://docs.logto.io/docs/tutorials/get-started/enable-passcode-sign-in/#enable-connector-in-sign-in-experience).
|
|
106
|
+
|
|
107
|
+
### Configure types
|
|
108
|
+
|
|
109
|
+
| Name | Type |
|
|
110
|
+
| ----------------------------------------- | ----------------- |
|
|
111
|
+
| accessKeyId | string |
|
|
112
|
+
| accessKeySecret | string |
|
|
113
|
+
| region | string |
|
|
114
|
+
| emailAddress | string (OPTIONAL) |
|
|
115
|
+
| emailAddressIdentityArn | string (OPTIONAL) |
|
|
116
|
+
| feedbackForwardingEmailAddress | string (OPTIONAL) |
|
|
117
|
+
| feedbackForwardingEmailAddressIdentityArn | string (OPTIONAL) |
|
|
118
|
+
| configurationSetName | string (OPTIONAL) |
|
|
119
|
+
| templates | Template[] |
|
|
120
|
+
|
|
121
|
+
| Template Properties | Type | Enum values |
|
|
122
|
+
| ------------------- | ----------- | ------------------------------------------------------------------ |
|
|
123
|
+
| subject | string | N/A |
|
|
124
|
+
| content | string | N/A |
|
|
125
|
+
| usageType | enum string | 'Register' \| 'SignIn' \| 'ForgotPassword' \| 'Continue' \| 'Test' |
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# AWS SES 邮件连接器
|
|
129
|
+
|
|
130
|
+
## 开始上手
|
|
131
|
+
|
|
132
|
+
Amazon SES 是云电子邮件发送服务,它可以集成到任何应用程序中,用于批量发送电子邮件。
|
|
133
|
+
|
|
134
|
+
本连接器是 Logto 官方提供的 Amazon SES 邮件连接器,帮助终端用户通过邮件验证码进行登录注册。
|
|
135
|
+
|
|
136
|
+
## 在 AWS 服务控制台中配置一个邮件服务
|
|
137
|
+
|
|
138
|
+
> 💡 **Tip**
|
|
139
|
+
>
|
|
140
|
+
> 你可以跳过已经完成的部分。
|
|
141
|
+
|
|
142
|
+
### 注册 AWS 帐号
|
|
143
|
+
|
|
144
|
+
前往 [AWS](https://aws.amazon.com/) 并完成帐号的注册。
|
|
145
|
+
|
|
146
|
+
### 创建发信身份
|
|
147
|
+
|
|
148
|
+
- 进入 `Amazon Simple Email Service` Console
|
|
149
|
+
- 创建发信身份,根据需要,以下任选一种
|
|
150
|
+
- 创建域
|
|
151
|
+
- 电子邮件地址
|
|
152
|
+
|
|
153
|
+
## 编写连接器的 JSON
|
|
154
|
+
|
|
155
|
+
1. 在 Amazon 控制台右上角点击你的用户名,进入`安全凭证`,如果你没有,请创建 `AccessKey`,并妥善保存
|
|
156
|
+
2. 完成 `Amazon Simple Email Service` 连接器的设置:
|
|
157
|
+
- 使用在步骤 1 中拿到的一对「AccessKey ID」和「AccessKey Secret」来分别填入 `accessKeyId` 和 `accessKeySecret`
|
|
158
|
+
- `region`:使用发信身份所在的 region 填入`region` 字段
|
|
159
|
+
- `emailAddress`:发信人邮箱地址,格式:`Logto<noreply@logto.io>`,也可以仅使用 `<noreply@logto.io>`
|
|
160
|
+
|
|
161
|
+
以下参数通常不需要配置,除非你明确知道你需要做什么;参数的含义可以参考 [AWS SES DOC](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html)。
|
|
162
|
+
- `feedbackForwardingEmailAddress`
|
|
163
|
+
- `feedbackForwardingEmailAddressIdentityArn`
|
|
164
|
+
- `configurationSetName`
|
|
165
|
+
|
|
166
|
+
这是一个 Amazon SES 邮件服务连接器 JSON 配置的样例。
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"accessKeyId": "<access-key-id>",
|
|
171
|
+
"accessKeySecret": "<access-key-secret>",
|
|
172
|
+
"region": "<region>",
|
|
173
|
+
"emailAddress": "<noreply@logto.io>",
|
|
174
|
+
"templates": [
|
|
175
|
+
{
|
|
176
|
+
"usageType": "SignIn",
|
|
177
|
+
"subject": "<sign-in-template-subject>",
|
|
178
|
+
"content": "<sign-in-template-content>"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"usageType": "Register",
|
|
182
|
+
"subject": "<register-template-subject>",
|
|
183
|
+
"content": "<register-template-content>"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"usageType": "ForgotPassword",
|
|
187
|
+
"subject": "<forgot-password-template-subject>",
|
|
188
|
+
"content": "<forgot-password-template-content>"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"usageType": "Continue",
|
|
192
|
+
"subject": "<continue-template-subject>",
|
|
193
|
+
"content": "<continue-template-content>"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"usageType": "Test",
|
|
197
|
+
"subject": "<test-template-subject>",
|
|
198
|
+
"content": "<test-template-content>"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 测试 Amazon SES 邮件连接器
|
|
206
|
+
|
|
207
|
+
你可以在「保存并完成」之前输入一个邮件地址并点按「发送」来测试配置是否可以正常工作。
|
|
208
|
+
|
|
209
|
+
大功告成!快去 [启用短信或邮件验证码登录](https://docs.logto.io/zh-cn/docs/tutorials/get-started/enable-passcode-sign-in/#%E5%9C%A8%E7%99%BB%E5%BD%95%E4%BD%93%E9%AA%8C%E4%B8%AD%E5%90%AF%E7%94%A8%E8%BF%9E%E6%8E%A5%E5%99%A8) 吧。
|
|
210
|
+
|
|
211
|
+
### 配置类型
|
|
212
|
+
|
|
213
|
+
| 名称 | 类型 |
|
|
214
|
+
| ----------------------------------------- | ----------------- |
|
|
215
|
+
| accessKeyId | string |
|
|
216
|
+
| accessKeySecret | string |
|
|
217
|
+
| region | string |
|
|
218
|
+
| emailAddress | string (OPTIONAL) |
|
|
219
|
+
| emailAddressIdentityArn | string (OPTIONAL) |
|
|
220
|
+
| feedbackForwardingEmailAddress | string (OPTIONAL) |
|
|
221
|
+
| feedbackForwardingEmailAddressIdentityArn | string (OPTIONAL) |
|
|
222
|
+
| configurationSetName | string (OPTIONAL) |
|
|
223
|
+
| templates | Template[] |
|
|
224
|
+
|
|
225
|
+
| 模板属性 | 类型 | 枚举值 |
|
|
226
|
+
| --------- | ----------- | ------------------------------------------------------------------ |
|
|
227
|
+
| subject | string | N/A |
|
|
228
|
+
| content | string | N/A |
|
|
229
|
+
| usageType | enum string | 'Register' \| 'SignIn' \| 'ForgotPassword' \| 'Continue' \| 'Test' |
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"accessKeyId": "<access-key-id>",
|
|
3
|
+
"accessKeySecret": "<access-key-secret>",
|
|
4
|
+
"region": "<region>",
|
|
5
|
+
"emailAddress": "<OPTIONAL-verified-email>",
|
|
6
|
+
"emailAddressIdentityArn": "<OPTIONAL-email-arn>",
|
|
7
|
+
"feedbackForwardingEmailAddress": "<OPTIONAL-feedback-email>",
|
|
8
|
+
"feedbackForwardingEmailAddressIdentityArn": "<OPTIONAL-feedback-email-arn>",
|
|
9
|
+
"configurationSetName": "<OPTIONAL-configuration-set>",
|
|
10
|
+
"templates": [
|
|
11
|
+
{
|
|
12
|
+
"usageType": "SignIn",
|
|
13
|
+
"subject": "<sign-in-template-subject>",
|
|
14
|
+
"content": "<sign-in-template-content>"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"usageType": "Register",
|
|
18
|
+
"subject": "<register-template-subject>",
|
|
19
|
+
"content": "<register-template-content>"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"usageType": "ForgotPassword",
|
|
23
|
+
"subject": "<forgot-password-template-subject>",
|
|
24
|
+
"content": "<forgot-password-template-content>"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"usageType": "Continue",
|
|
28
|
+
"subject": "<continue-template-subject>",
|
|
29
|
+
"content": "<continue-template-content>"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"usageType": "Test",
|
|
33
|
+
"subject": "<test-template-subject>",
|
|
34
|
+
"content": "<test-template-content>"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|