@nocobase/plugin-notifications 2.3.0-beta.9 → 2.4.0-alpha.10
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/dist/externalVersion.js +3 -3
- package/dist/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +59 -0
- package/dist/node_modules/nodemailer/dist/cjs/addressparser/index.js +790 -0
- package/dist/node_modules/nodemailer/dist/cjs/base64/index.d.ts +36 -0
- package/dist/node_modules/nodemailer/dist/cjs/base64/index.js +119 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +52 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/index.js +228 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +48 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +180 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +36 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.js +148 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +52 -0
- package/dist/node_modules/nodemailer/dist/cjs/dkim/sign.js +165 -0
- package/dist/node_modules/nodemailer/dist/cjs/errors.d.ts +96 -0
- package/dist/node_modules/nodemailer/dist/cjs/errors.js +70 -0
- package/dist/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +107 -0
- package/dist/node_modules/nodemailer/dist/cjs/fetch/cookies.js +282 -0
- package/dist/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +65 -0
- package/dist/node_modules/nodemailer/dist/cjs/fetch/index.js +384 -0
- package/dist/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +64 -0
- package/dist/node_modules/nodemailer/dist/cjs/json-transport/index.js +99 -0
- package/dist/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +174 -0
- package/dist/node_modules/nodemailer/dist/cjs/mail-composer/index.js +613 -0
- package/dist/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +237 -0
- package/dist/node_modules/nodemailer/dist/cjs/mailer/index.js +415 -0
- package/dist/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +97 -0
- package/dist/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +342 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +161 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +787 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/mime-types.d.ts +2 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/mime-types.js +2103 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +333 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/index.js +1493 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/last-newline.d.ts +5 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/last-newline.js +32 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-unix.d.ts +9 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-unix.js +40 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-windows.d.ts +10 -0
- package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-windows.js +47 -0
- package/dist/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +124 -0
- package/dist/node_modules/nodemailer/dist/cjs/nodemailer.js +1 -0
- package/dist/node_modules/nodemailer/dist/cjs/package-info.d.ts +3 -0
- package/dist/node_modules/nodemailer/dist/cjs/package-info.js +7 -0
- package/dist/node_modules/nodemailer/dist/cjs/package.json +3 -0
- package/dist/node_modules/nodemailer/dist/cjs/punycode/index.d.ts +73 -0
- package/dist/node_modules/nodemailer/dist/cjs/punycode/index.js +411 -0
- package/dist/node_modules/nodemailer/dist/cjs/qp/index.d.ts +32 -0
- package/dist/node_modules/nodemailer/dist/cjs/qp/index.js +207 -0
- package/dist/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +69 -0
- package/dist/node_modules/nodemailer/dist/cjs/sendmail-transport/index.js +210 -0
- package/dist/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +112 -0
- package/dist/node_modules/nodemailer/dist/cjs/ses-transport/index.js +252 -0
- package/dist/node_modules/nodemailer/dist/cjs/shared/index.d.ts +260 -0
- package/dist/node_modules/nodemailer/dist/cjs/shared/index.js +680 -0
- package/dist/node_modules/nodemailer/dist/cjs/shared/objects.d.ts +23 -0
- package/dist/node_modules/nodemailer/dist/cjs/shared/objects.js +43 -0
- package/dist/node_modules/nodemailer/dist/cjs/shared/url.d.ts +21 -0
- package/dist/node_modules/nodemailer/dist/cjs/shared/url.js +255 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +15 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +108 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +47 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.js +189 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +416 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +1837 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +133 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +569 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.d.ts +62 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +257 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +156 -0
- package/dist/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +371 -0
- package/dist/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +65 -0
- package/dist/node_modules/nodemailer/dist/cjs/stream-transport/index.js +146 -0
- package/dist/node_modules/nodemailer/dist/cjs/well-known/index.d.ts +35 -0
- package/dist/node_modules/nodemailer/dist/cjs/well-known/index.js +41 -0
- package/dist/node_modules/nodemailer/dist/cjs/well-known/services.d.ts +2 -0
- package/dist/node_modules/nodemailer/dist/cjs/well-known/services.js +674 -0
- package/dist/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +201 -0
- package/dist/node_modules/nodemailer/dist/cjs/xoauth2/index.js +426 -0
- package/dist/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +59 -0
- package/dist/node_modules/nodemailer/dist/esm/addressparser/index.js +786 -0
- package/dist/node_modules/nodemailer/dist/esm/base64/index.d.ts +36 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/base64/index.js +39 -68
- package/dist/node_modules/nodemailer/dist/esm/dkim/index.d.ts +52 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/dkim/index.js +62 -92
- package/dist/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +48 -0
- package/dist/node_modules/nodemailer/dist/esm/dkim/message-parser.js +176 -0
- package/dist/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +36 -0
- package/dist/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +141 -0
- package/dist/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +52 -0
- package/dist/node_modules/nodemailer/dist/esm/dkim/sign.js +125 -0
- package/dist/node_modules/nodemailer/dist/esm/errors.d.ts +96 -0
- package/dist/node_modules/nodemailer/dist/esm/errors.js +67 -0
- package/dist/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +107 -0
- package/dist/node_modules/nodemailer/dist/esm/fetch/cookies.js +242 -0
- package/dist/node_modules/nodemailer/dist/esm/fetch/index.d.ts +65 -0
- package/dist/node_modules/nodemailer/dist/esm/fetch/index.js +344 -0
- package/dist/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +64 -0
- package/dist/node_modules/nodemailer/dist/esm/json-transport/index.js +62 -0
- package/dist/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +174 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mail-composer/index.js +288 -280
- package/dist/node_modules/nodemailer/dist/esm/mailer/index.d.ts +237 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mailer/index.js +142 -194
- package/dist/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +97 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mailer/mail-message.js +111 -125
- package/dist/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +161 -0
- package/dist/node_modules/nodemailer/dist/esm/mime-funcs/index.js +738 -0
- package/dist/node_modules/nodemailer/dist/esm/mime-funcs/mime-types.d.ts +2 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-funcs/mime-types.js +43 -49
- package/dist/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +333 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/index.js +584 -436
- package/dist/node_modules/nodemailer/dist/esm/mime-node/last-newline.d.ts +5 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/last-newline.js +4 -10
- package/dist/node_modules/nodemailer/dist/esm/mime-node/le-unix.d.ts +9 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/le-unix.js +7 -15
- package/dist/node_modules/nodemailer/dist/esm/mime-node/le-windows.d.ts +10 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/le-windows.js +6 -16
- package/dist/node_modules/nodemailer/dist/esm/nodemailer.d.ts +124 -0
- package/dist/node_modules/nodemailer/dist/esm/nodemailer.js +166 -0
- package/dist/node_modules/nodemailer/dist/esm/package-info.d.ts +3 -0
- package/dist/node_modules/nodemailer/dist/esm/package-info.js +4 -0
- package/dist/node_modules/nodemailer/dist/esm/package.json +3 -0
- package/dist/node_modules/nodemailer/dist/esm/punycode/index.d.ts +73 -0
- package/dist/node_modules/nodemailer/dist/esm/punycode/index.js +405 -0
- package/dist/node_modules/nodemailer/dist/esm/qp/index.d.ts +32 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/qp/index.js +59 -77
- package/dist/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +69 -0
- package/dist/node_modules/nodemailer/dist/esm/sendmail-transport/index.js +170 -0
- package/dist/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +112 -0
- package/dist/node_modules/nodemailer/dist/esm/ses-transport/index.js +212 -0
- package/dist/node_modules/nodemailer/dist/esm/shared/index.d.ts +260 -0
- package/dist/node_modules/nodemailer/dist/esm/shared/index.js +631 -0
- package/dist/node_modules/nodemailer/dist/esm/shared/objects.d.ts +23 -0
- package/dist/node_modules/nodemailer/dist/esm/shared/objects.js +38 -0
- package/dist/node_modules/nodemailer/dist/esm/shared/url.d.ts +21 -0
- package/dist/node_modules/nodemailer/dist/esm/shared/url.js +214 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +15 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +103 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +47 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js +149 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +416 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-connection/index.js +1797 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +133 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-pool/index.js +195 -314
- package/dist/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.d.ts +62 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-pool/pool-resource.js +70 -107
- package/dist/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +156 -0
- package/dist/node_modules/nodemailer/dist/esm/smtp-transport/index.js +331 -0
- package/dist/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +65 -0
- package/dist/node_modules/nodemailer/dist/esm/stream-transport/index.js +106 -0
- package/dist/node_modules/nodemailer/dist/esm/well-known/index.d.ts +35 -0
- package/dist/node_modules/nodemailer/{lib → dist/esm}/well-known/index.js +12 -23
- package/dist/node_modules/nodemailer/dist/esm/well-known/services.d.ts +2 -0
- package/dist/node_modules/nodemailer/dist/esm/well-known/services.js +671 -0
- package/dist/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +201 -0
- package/dist/node_modules/nodemailer/dist/esm/xoauth2/index.js +386 -0
- package/dist/node_modules/nodemailer/dist/well-known/services.json +640 -0
- package/dist/node_modules/nodemailer/package.json +1 -1
- package/dist/server/models/NotificationService.d.ts +1 -2
- package/package.json +3 -3
- package/dist/node_modules/nodemailer/.gitattributes +0 -6
- package/dist/node_modules/nodemailer/.ncurc.js +0 -7
- package/dist/node_modules/nodemailer/.prettierrc.js +0 -8
- package/dist/node_modules/nodemailer/lib/addressparser/index.js +0 -313
- package/dist/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
- package/dist/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
- package/dist/node_modules/nodemailer/lib/dkim/sign.js +0 -117
- package/dist/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
- package/dist/node_modules/nodemailer/lib/fetch/index.js +0 -274
- package/dist/node_modules/nodemailer/lib/json-transport/index.js +0 -82
- package/dist/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
- package/dist/node_modules/nodemailer/lib/nodemailer.js +0 -1
- package/dist/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
- package/dist/node_modules/nodemailer/lib/ses-transport/index.js +0 -349
- package/dist/node_modules/nodemailer/lib/shared/index.js +0 -638
- package/dist/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
- package/dist/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
- package/dist/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1812
- package/dist/node_modules/nodemailer/lib/smtp-transport/index.js +0 -416
- package/dist/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
- package/dist/node_modules/nodemailer/lib/well-known/services.json +0 -338
- package/dist/node_modules/nodemailer/lib/xoauth2/index.js +0 -376
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"1und1": {
|
|
3
|
-
"host": "smtp.1und1.de",
|
|
4
|
-
"port": 465,
|
|
5
|
-
"secure": true,
|
|
6
|
-
"authMethod": "LOGIN"
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
"Aliyun": {
|
|
10
|
-
"domains": ["aliyun.com"],
|
|
11
|
-
"host": "smtp.aliyun.com",
|
|
12
|
-
"port": 465,
|
|
13
|
-
"secure": true
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
"AOL": {
|
|
17
|
-
"domains": ["aol.com"],
|
|
18
|
-
"host": "smtp.aol.com",
|
|
19
|
-
"port": 587
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
"Bluewin": {
|
|
23
|
-
"host": "smtpauths.bluewin.ch",
|
|
24
|
-
"domains": ["bluewin.ch"],
|
|
25
|
-
"port": 465
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
"DebugMail": {
|
|
29
|
-
"host": "debugmail.io",
|
|
30
|
-
"port": 25
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
"DynectEmail": {
|
|
34
|
-
"aliases": ["Dynect"],
|
|
35
|
-
"host": "smtp.dynect.net",
|
|
36
|
-
"port": 25
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
"Ethereal": {
|
|
40
|
-
"aliases": ["ethereal.email"],
|
|
41
|
-
"host": "smtp.ethereal.email",
|
|
42
|
-
"port": 587
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
"FastMail": {
|
|
46
|
-
"domains": ["fastmail.fm"],
|
|
47
|
-
"host": "smtp.fastmail.com",
|
|
48
|
-
"port": 465,
|
|
49
|
-
"secure": true
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
"Forward Email": {
|
|
53
|
-
"aliases": ["FE", "ForwardEmail"],
|
|
54
|
-
"domains": ["forwardemail.net"],
|
|
55
|
-
"host": "smtp.forwardemail.net",
|
|
56
|
-
"port": 465,
|
|
57
|
-
"secure": true
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
"GandiMail": {
|
|
61
|
-
"aliases": ["Gandi", "Gandi Mail"],
|
|
62
|
-
"host": "mail.gandi.net",
|
|
63
|
-
"port": 587
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
"Gmail": {
|
|
67
|
-
"aliases": ["Google Mail"],
|
|
68
|
-
"domains": ["gmail.com", "googlemail.com"],
|
|
69
|
-
"host": "smtp.gmail.com",
|
|
70
|
-
"port": 465,
|
|
71
|
-
"secure": true
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
"Godaddy": {
|
|
75
|
-
"host": "smtpout.secureserver.net",
|
|
76
|
-
"port": 25
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
"GodaddyAsia": {
|
|
80
|
-
"host": "smtp.asia.secureserver.net",
|
|
81
|
-
"port": 25
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
"GodaddyEurope": {
|
|
85
|
-
"host": "smtp.europe.secureserver.net",
|
|
86
|
-
"port": 25
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
"hot.ee": {
|
|
90
|
-
"host": "mail.hot.ee"
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
"Hotmail": {
|
|
94
|
-
"aliases": ["Outlook", "Outlook.com", "Hotmail.com"],
|
|
95
|
-
"domains": ["hotmail.com", "outlook.com"],
|
|
96
|
-
"host": "smtp-mail.outlook.com",
|
|
97
|
-
"port": 587
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
"iCloud": {
|
|
101
|
-
"aliases": ["Me", "Mac"],
|
|
102
|
-
"domains": ["me.com", "mac.com"],
|
|
103
|
-
"host": "smtp.mail.me.com",
|
|
104
|
-
"port": 587
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
"Infomaniak": {
|
|
108
|
-
"host": "mail.infomaniak.com",
|
|
109
|
-
"domains": ["ik.me", "ikmail.com", "etik.com"],
|
|
110
|
-
"port": 587
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
"mail.ee": {
|
|
114
|
-
"host": "smtp.mail.ee"
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
"Mail.ru": {
|
|
118
|
-
"host": "smtp.mail.ru",
|
|
119
|
-
"port": 465,
|
|
120
|
-
"secure": true
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
"Maildev": {
|
|
124
|
-
"port": 1025,
|
|
125
|
-
"ignoreTLS": true
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
"Mailgun": {
|
|
129
|
-
"host": "smtp.mailgun.org",
|
|
130
|
-
"port": 465,
|
|
131
|
-
"secure": true
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
"Mailjet": {
|
|
135
|
-
"host": "in.mailjet.com",
|
|
136
|
-
"port": 587
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
"Mailosaur": {
|
|
140
|
-
"host": "mailosaur.io",
|
|
141
|
-
"port": 25
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
"Mailtrap": {
|
|
145
|
-
"host": "smtp.mailtrap.io",
|
|
146
|
-
"port": 2525
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
"Mandrill": {
|
|
150
|
-
"host": "smtp.mandrillapp.com",
|
|
151
|
-
"port": 587
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
"Naver": {
|
|
155
|
-
"host": "smtp.naver.com",
|
|
156
|
-
"port": 587
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
"One": {
|
|
160
|
-
"host": "send.one.com",
|
|
161
|
-
"port": 465,
|
|
162
|
-
"secure": true
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
"OpenMailBox": {
|
|
166
|
-
"aliases": ["OMB", "openmailbox.org"],
|
|
167
|
-
"host": "smtp.openmailbox.org",
|
|
168
|
-
"port": 465,
|
|
169
|
-
"secure": true
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
"Outlook365": {
|
|
173
|
-
"host": "smtp.office365.com",
|
|
174
|
-
"port": 587,
|
|
175
|
-
"secure": false
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
"OhMySMTP": {
|
|
179
|
-
"host": "smtp.ohmysmtp.com",
|
|
180
|
-
"port": 587,
|
|
181
|
-
"secure": false
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
"Postmark": {
|
|
185
|
-
"aliases": ["PostmarkApp"],
|
|
186
|
-
"host": "smtp.postmarkapp.com",
|
|
187
|
-
"port": 2525
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
"qiye.aliyun": {
|
|
191
|
-
"host": "smtp.mxhichina.com",
|
|
192
|
-
"port": "465",
|
|
193
|
-
"secure": true
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
"QQ": {
|
|
197
|
-
"domains": ["qq.com"],
|
|
198
|
-
"host": "smtp.qq.com",
|
|
199
|
-
"port": 465,
|
|
200
|
-
"secure": true
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
"QQex": {
|
|
204
|
-
"aliases": ["QQ Enterprise"],
|
|
205
|
-
"domains": ["exmail.qq.com"],
|
|
206
|
-
"host": "smtp.exmail.qq.com",
|
|
207
|
-
"port": 465,
|
|
208
|
-
"secure": true
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
"SendCloud": {
|
|
212
|
-
"host": "smtp.sendcloud.net",
|
|
213
|
-
"port": 2525
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
"SendGrid": {
|
|
217
|
-
"host": "smtp.sendgrid.net",
|
|
218
|
-
"port": 587
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
"SendinBlue": {
|
|
222
|
-
"aliases": ["Brevo"],
|
|
223
|
-
"host": "smtp-relay.brevo.com",
|
|
224
|
-
"port": 587
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
"SendPulse": {
|
|
228
|
-
"host": "smtp-pulse.com",
|
|
229
|
-
"port": 465,
|
|
230
|
-
"secure": true
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
"SES": {
|
|
234
|
-
"host": "email-smtp.us-east-1.amazonaws.com",
|
|
235
|
-
"port": 465,
|
|
236
|
-
"secure": true
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
"SES-US-EAST-1": {
|
|
240
|
-
"host": "email-smtp.us-east-1.amazonaws.com",
|
|
241
|
-
"port": 465,
|
|
242
|
-
"secure": true
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
"SES-US-WEST-2": {
|
|
246
|
-
"host": "email-smtp.us-west-2.amazonaws.com",
|
|
247
|
-
"port": 465,
|
|
248
|
-
"secure": true
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
"SES-EU-WEST-1": {
|
|
252
|
-
"host": "email-smtp.eu-west-1.amazonaws.com",
|
|
253
|
-
"port": 465,
|
|
254
|
-
"secure": true
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
"SES-AP-SOUTH-1": {
|
|
258
|
-
"host": "email-smtp.ap-south-1.amazonaws.com",
|
|
259
|
-
"port": 465,
|
|
260
|
-
"secure": true
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
"SES-AP-NORTHEAST-1": {
|
|
264
|
-
"host": "email-smtp.ap-northeast-1.amazonaws.com",
|
|
265
|
-
"port": 465,
|
|
266
|
-
"secure": true
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
"SES-AP-NORTHEAST-2": {
|
|
270
|
-
"host": "email-smtp.ap-northeast-2.amazonaws.com",
|
|
271
|
-
"port": 465,
|
|
272
|
-
"secure": true
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
"SES-AP-NORTHEAST-3": {
|
|
276
|
-
"host": "email-smtp.ap-northeast-3.amazonaws.com",
|
|
277
|
-
"port": 465,
|
|
278
|
-
"secure": true
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
"SES-AP-SOUTHEAST-1": {
|
|
282
|
-
"host": "email-smtp.ap-southeast-1.amazonaws.com",
|
|
283
|
-
"port": 465,
|
|
284
|
-
"secure": true
|
|
285
|
-
},
|
|
286
|
-
|
|
287
|
-
"SES-AP-SOUTHEAST-2": {
|
|
288
|
-
"host": "email-smtp.ap-southeast-2.amazonaws.com",
|
|
289
|
-
"port": 465,
|
|
290
|
-
"secure": true
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
"Sparkpost": {
|
|
294
|
-
"aliases": ["SparkPost", "SparkPost Mail"],
|
|
295
|
-
"domains": ["sparkpost.com"],
|
|
296
|
-
"host": "smtp.sparkpostmail.com",
|
|
297
|
-
"port": 587,
|
|
298
|
-
"secure": false
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
"Tipimail": {
|
|
302
|
-
"host": "smtp.tipimail.com",
|
|
303
|
-
"port": 587
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
"Yahoo": {
|
|
307
|
-
"domains": ["yahoo.com"],
|
|
308
|
-
"host": "smtp.mail.yahoo.com",
|
|
309
|
-
"port": 465,
|
|
310
|
-
"secure": true
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
"Yandex": {
|
|
314
|
-
"domains": ["yandex.ru"],
|
|
315
|
-
"host": "smtp.yandex.ru",
|
|
316
|
-
"port": 465,
|
|
317
|
-
"secure": true
|
|
318
|
-
},
|
|
319
|
-
|
|
320
|
-
"Zoho": {
|
|
321
|
-
"host": "smtp.zoho.com",
|
|
322
|
-
"port": 465,
|
|
323
|
-
"secure": true,
|
|
324
|
-
"authMethod": "LOGIN"
|
|
325
|
-
},
|
|
326
|
-
|
|
327
|
-
"126": {
|
|
328
|
-
"host": "smtp.126.com",
|
|
329
|
-
"port": 465,
|
|
330
|
-
"secure": true
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
"163": {
|
|
334
|
-
"host": "smtp.163.com",
|
|
335
|
-
"port": 465,
|
|
336
|
-
"secure": true
|
|
337
|
-
}
|
|
338
|
-
}
|
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Stream = require('stream').Stream;
|
|
4
|
-
const nmfetch = require('../fetch');
|
|
5
|
-
const crypto = require('crypto');
|
|
6
|
-
const shared = require('../shared');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* XOAUTH2 access_token generator for Gmail.
|
|
10
|
-
* Create client ID for web applications in Google API console to use it.
|
|
11
|
-
* See Offline Access for receiving the needed refreshToken for an user
|
|
12
|
-
* https://developers.google.com/accounts/docs/OAuth2WebServer#offline
|
|
13
|
-
*
|
|
14
|
-
* Usage for generating access tokens with a custom method using provisionCallback:
|
|
15
|
-
* provisionCallback(user, renew, callback)
|
|
16
|
-
* * user is the username to get the token for
|
|
17
|
-
* * renew is a boolean that if true indicates that existing token failed and needs to be renewed
|
|
18
|
-
* * callback is the callback to run with (error, accessToken [, expires])
|
|
19
|
-
* * accessToken is a string
|
|
20
|
-
* * expires is an optional expire time in milliseconds
|
|
21
|
-
* If provisionCallback is used, then Nodemailer does not try to attempt generating the token by itself
|
|
22
|
-
*
|
|
23
|
-
* @constructor
|
|
24
|
-
* @param {Object} options Client information for token generation
|
|
25
|
-
* @param {String} options.user User e-mail address
|
|
26
|
-
* @param {String} options.clientId Client ID value
|
|
27
|
-
* @param {String} options.clientSecret Client secret value
|
|
28
|
-
* @param {String} options.refreshToken Refresh token for an user
|
|
29
|
-
* @param {String} options.accessUrl Endpoint for token generation, defaults to 'https://accounts.google.com/o/oauth2/token'
|
|
30
|
-
* @param {String} options.accessToken An existing valid accessToken
|
|
31
|
-
* @param {String} options.privateKey Private key for JSW
|
|
32
|
-
* @param {Number} options.expires Optional Access Token expire time in ms
|
|
33
|
-
* @param {Number} options.timeout Optional TTL for Access Token in seconds
|
|
34
|
-
* @param {Function} options.provisionCallback Function to run when a new access token is required
|
|
35
|
-
*/
|
|
36
|
-
class XOAuth2 extends Stream {
|
|
37
|
-
constructor(options, logger) {
|
|
38
|
-
super();
|
|
39
|
-
|
|
40
|
-
this.options = options || {};
|
|
41
|
-
|
|
42
|
-
if (options && options.serviceClient) {
|
|
43
|
-
if (!options.privateKey || !options.user) {
|
|
44
|
-
setImmediate(() => this.emit('error', new Error('Options "privateKey" and "user" are required for service account!')));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
let serviceRequestTimeout = Math.min(Math.max(Number(this.options.serviceRequestTimeout) || 0, 0), 3600);
|
|
49
|
-
this.options.serviceRequestTimeout = serviceRequestTimeout || 5 * 60;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.logger = shared.getLogger(
|
|
53
|
-
{
|
|
54
|
-
logger
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
component: this.options.component || 'OAuth2'
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
this.provisionCallback = typeof this.options.provisionCallback === 'function' ? this.options.provisionCallback : false;
|
|
62
|
-
|
|
63
|
-
this.options.accessUrl = this.options.accessUrl || 'https://accounts.google.com/o/oauth2/token';
|
|
64
|
-
this.options.customHeaders = this.options.customHeaders || {};
|
|
65
|
-
this.options.customParams = this.options.customParams || {};
|
|
66
|
-
|
|
67
|
-
this.accessToken = this.options.accessToken || false;
|
|
68
|
-
|
|
69
|
-
if (this.options.expires && Number(this.options.expires)) {
|
|
70
|
-
this.expires = this.options.expires;
|
|
71
|
-
} else {
|
|
72
|
-
let timeout = Math.max(Number(this.options.timeout) || 0, 0);
|
|
73
|
-
this.expires = (timeout && Date.now() + timeout * 1000) || 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Returns or generates (if previous has expired) a XOAuth2 token
|
|
79
|
-
*
|
|
80
|
-
* @param {Boolean} renew If false then use cached access token (if available)
|
|
81
|
-
* @param {Function} callback Callback function with error object and token string
|
|
82
|
-
*/
|
|
83
|
-
getToken(renew, callback) {
|
|
84
|
-
if (!renew && this.accessToken && (!this.expires || this.expires > Date.now())) {
|
|
85
|
-
return callback(null, this.accessToken);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let generateCallback = (...args) => {
|
|
89
|
-
if (args[0]) {
|
|
90
|
-
this.logger.error(
|
|
91
|
-
{
|
|
92
|
-
err: args[0],
|
|
93
|
-
tnx: 'OAUTH2',
|
|
94
|
-
user: this.options.user,
|
|
95
|
-
action: 'renew'
|
|
96
|
-
},
|
|
97
|
-
'Failed generating new Access Token for %s',
|
|
98
|
-
this.options.user
|
|
99
|
-
);
|
|
100
|
-
} else {
|
|
101
|
-
this.logger.info(
|
|
102
|
-
{
|
|
103
|
-
tnx: 'OAUTH2',
|
|
104
|
-
user: this.options.user,
|
|
105
|
-
action: 'renew'
|
|
106
|
-
},
|
|
107
|
-
'Generated new Access Token for %s',
|
|
108
|
-
this.options.user
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
callback(...args);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
if (this.provisionCallback) {
|
|
115
|
-
this.provisionCallback(this.options.user, !!renew, (err, accessToken, expires) => {
|
|
116
|
-
if (!err && accessToken) {
|
|
117
|
-
this.accessToken = accessToken;
|
|
118
|
-
this.expires = expires || 0;
|
|
119
|
-
}
|
|
120
|
-
generateCallback(err, accessToken);
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
this.generateToken(generateCallback);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Updates token values
|
|
129
|
-
*
|
|
130
|
-
* @param {String} accessToken New access token
|
|
131
|
-
* @param {Number} timeout Access token lifetime in seconds
|
|
132
|
-
*
|
|
133
|
-
* Emits 'token': { user: User email-address, accessToken: the new accessToken, timeout: TTL in seconds}
|
|
134
|
-
*/
|
|
135
|
-
updateToken(accessToken, timeout) {
|
|
136
|
-
this.accessToken = accessToken;
|
|
137
|
-
timeout = Math.max(Number(timeout) || 0, 0);
|
|
138
|
-
this.expires = (timeout && Date.now() + timeout * 1000) || 0;
|
|
139
|
-
|
|
140
|
-
this.emit('token', {
|
|
141
|
-
user: this.options.user,
|
|
142
|
-
accessToken: accessToken || '',
|
|
143
|
-
expires: this.expires
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Generates a new XOAuth2 token with the credentials provided at initialization
|
|
149
|
-
*
|
|
150
|
-
* @param {Function} callback Callback function with error object and token string
|
|
151
|
-
*/
|
|
152
|
-
generateToken(callback) {
|
|
153
|
-
let urlOptions;
|
|
154
|
-
let loggedUrlOptions;
|
|
155
|
-
if (this.options.serviceClient) {
|
|
156
|
-
// service account - https://developers.google.com/identity/protocols/OAuth2ServiceAccount
|
|
157
|
-
let iat = Math.floor(Date.now() / 1000); // unix time
|
|
158
|
-
let tokenData = {
|
|
159
|
-
iss: this.options.serviceClient,
|
|
160
|
-
scope: this.options.scope || 'https://mail.google.com/',
|
|
161
|
-
sub: this.options.user,
|
|
162
|
-
aud: this.options.accessUrl,
|
|
163
|
-
iat,
|
|
164
|
-
exp: iat + this.options.serviceRequestTimeout
|
|
165
|
-
};
|
|
166
|
-
let token;
|
|
167
|
-
try {
|
|
168
|
-
token = this.jwtSignRS256(tokenData);
|
|
169
|
-
} catch (err) {
|
|
170
|
-
return callback(new Error('Can\x27t generate token. Check your auth options'));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
urlOptions = {
|
|
174
|
-
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
|
|
175
|
-
assertion: token
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
loggedUrlOptions = {
|
|
179
|
-
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
|
|
180
|
-
assertion: tokenData
|
|
181
|
-
};
|
|
182
|
-
} else {
|
|
183
|
-
if (!this.options.refreshToken) {
|
|
184
|
-
return callback(new Error('Can\x27t create new access token for user'));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// web app - https://developers.google.com/identity/protocols/OAuth2WebServer
|
|
188
|
-
urlOptions = {
|
|
189
|
-
client_id: this.options.clientId || '',
|
|
190
|
-
client_secret: this.options.clientSecret || '',
|
|
191
|
-
refresh_token: this.options.refreshToken,
|
|
192
|
-
grant_type: 'refresh_token'
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
loggedUrlOptions = {
|
|
196
|
-
client_id: this.options.clientId || '',
|
|
197
|
-
client_secret: (this.options.clientSecret || '').substr(0, 6) + '...',
|
|
198
|
-
refresh_token: (this.options.refreshToken || '').substr(0, 6) + '...',
|
|
199
|
-
grant_type: 'refresh_token'
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
Object.keys(this.options.customParams).forEach(key => {
|
|
204
|
-
urlOptions[key] = this.options.customParams[key];
|
|
205
|
-
loggedUrlOptions[key] = this.options.customParams[key];
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
this.logger.debug(
|
|
209
|
-
{
|
|
210
|
-
tnx: 'OAUTH2',
|
|
211
|
-
user: this.options.user,
|
|
212
|
-
action: 'generate'
|
|
213
|
-
},
|
|
214
|
-
'Requesting token using: %s',
|
|
215
|
-
JSON.stringify(loggedUrlOptions)
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
this.postRequest(this.options.accessUrl, urlOptions, this.options, (error, body) => {
|
|
219
|
-
let data;
|
|
220
|
-
|
|
221
|
-
if (error) {
|
|
222
|
-
return callback(error);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
try {
|
|
226
|
-
data = JSON.parse(body.toString());
|
|
227
|
-
} catch (E) {
|
|
228
|
-
return callback(E);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (!data || typeof data !== 'object') {
|
|
232
|
-
this.logger.debug(
|
|
233
|
-
{
|
|
234
|
-
tnx: 'OAUTH2',
|
|
235
|
-
user: this.options.user,
|
|
236
|
-
action: 'post'
|
|
237
|
-
},
|
|
238
|
-
'Response: %s',
|
|
239
|
-
(body || '').toString()
|
|
240
|
-
);
|
|
241
|
-
return callback(new Error('Invalid authentication response'));
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
let logData = {};
|
|
245
|
-
Object.keys(data).forEach(key => {
|
|
246
|
-
if (key !== 'access_token') {
|
|
247
|
-
logData[key] = data[key];
|
|
248
|
-
} else {
|
|
249
|
-
logData[key] = (data[key] || '').toString().substr(0, 6) + '...';
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
this.logger.debug(
|
|
254
|
-
{
|
|
255
|
-
tnx: 'OAUTH2',
|
|
256
|
-
user: this.options.user,
|
|
257
|
-
action: 'post'
|
|
258
|
-
},
|
|
259
|
-
'Response: %s',
|
|
260
|
-
JSON.stringify(logData)
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
if (data.error) {
|
|
264
|
-
// Error Response : https://tools.ietf.org/html/rfc6749#section-5.2
|
|
265
|
-
let errorMessage = data.error;
|
|
266
|
-
if (data.error_description) {
|
|
267
|
-
errorMessage += ': ' + data.error_description;
|
|
268
|
-
}
|
|
269
|
-
if (data.error_uri) {
|
|
270
|
-
errorMessage += ' (' + data.error_uri + ')';
|
|
271
|
-
}
|
|
272
|
-
return callback(new Error(errorMessage));
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if (data.access_token) {
|
|
276
|
-
this.updateToken(data.access_token, data.expires_in);
|
|
277
|
-
return callback(null, this.accessToken);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return callback(new Error('No access token'));
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Converts an access_token and user id into a base64 encoded XOAuth2 token
|
|
286
|
-
*
|
|
287
|
-
* @param {String} [accessToken] Access token string
|
|
288
|
-
* @return {String} Base64 encoded token for IMAP or SMTP login
|
|
289
|
-
*/
|
|
290
|
-
buildXOAuth2Token(accessToken) {
|
|
291
|
-
let authData = ['user=' + (this.options.user || ''), 'auth=Bearer ' + (accessToken || this.accessToken), '', ''];
|
|
292
|
-
return Buffer.from(authData.join('\x01'), 'utf-8').toString('base64');
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Custom POST request handler.
|
|
297
|
-
* This is only needed to keep paths short in Windows – usually this module
|
|
298
|
-
* is a dependency of a dependency and if it tries to require something
|
|
299
|
-
* like the request module the paths get way too long to handle for Windows.
|
|
300
|
-
* As we do only a simple POST request we do not actually require complicated
|
|
301
|
-
* logic support (no redirects, no nothing) anyway.
|
|
302
|
-
*
|
|
303
|
-
* @param {String} url Url to POST to
|
|
304
|
-
* @param {String|Buffer} payload Payload to POST
|
|
305
|
-
* @param {Function} callback Callback function with (err, buff)
|
|
306
|
-
*/
|
|
307
|
-
postRequest(url, payload, params, callback) {
|
|
308
|
-
let returned = false;
|
|
309
|
-
|
|
310
|
-
let chunks = [];
|
|
311
|
-
let chunklen = 0;
|
|
312
|
-
|
|
313
|
-
let req = nmfetch(url, {
|
|
314
|
-
method: 'post',
|
|
315
|
-
headers: params.customHeaders,
|
|
316
|
-
body: payload,
|
|
317
|
-
allowErrorResponse: true
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
req.on('readable', () => {
|
|
321
|
-
let chunk;
|
|
322
|
-
while ((chunk = req.read()) !== null) {
|
|
323
|
-
chunks.push(chunk);
|
|
324
|
-
chunklen += chunk.length;
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
req.once('error', err => {
|
|
329
|
-
if (returned) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
returned = true;
|
|
333
|
-
return callback(err);
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
req.once('end', () => {
|
|
337
|
-
if (returned) {
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
returned = true;
|
|
341
|
-
return callback(null, Buffer.concat(chunks, chunklen));
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Encodes a buffer or a string into Base64url format
|
|
347
|
-
*
|
|
348
|
-
* @param {Buffer|String} data The data to convert
|
|
349
|
-
* @return {String} The encoded string
|
|
350
|
-
*/
|
|
351
|
-
toBase64URL(data) {
|
|
352
|
-
if (typeof data === 'string') {
|
|
353
|
-
data = Buffer.from(data);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
return data
|
|
357
|
-
.toString('base64')
|
|
358
|
-
.replace(/[=]+/g, '') // remove '='s
|
|
359
|
-
.replace(/\+/g, '-') // '+' → '-'
|
|
360
|
-
.replace(/\//g, '_'); // '/' → '_'
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Creates a JSON Web Token signed with RS256 (SHA256 + RSA)
|
|
365
|
-
*
|
|
366
|
-
* @param {Object} payload The payload to include in the generated token
|
|
367
|
-
* @return {String} The generated and signed token
|
|
368
|
-
*/
|
|
369
|
-
jwtSignRS256(payload) {
|
|
370
|
-
payload = ['{"alg":"RS256","typ":"JWT"}', JSON.stringify(payload)].map(val => this.toBase64URL(val)).join('.');
|
|
371
|
-
let signature = crypto.createSign('RSA-SHA256').update(payload).sign(this.options.privateKey);
|
|
372
|
-
return payload + '.' + this.toBase64URL(signature);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
module.exports = XOAuth2;
|