@capawesome/capacitor-apple-sign-in 0.0.1
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/CapawesomeCapacitorAppleSignIn.podspec +17 -0
- package/Package.swift +28 -0
- package/README.md +220 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/AppleSignIn.java +98 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/AppleSignInActivity.java +366 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/AppleSignInPlugin.java +106 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/classes/CustomException.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/classes/CustomExceptions.java +12 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/classes/options/SignInOptions.java +84 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/classes/results/SignInResult.java +65 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/applesignin/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/drawable/ic_close.xml +9 -0
- package/dist/docs.json +345 -0
- package/dist/esm/definitions.d.ts +181 -0
- package/dist/esm/definitions.js +55 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +10 -0
- package/dist/esm/web.js +79 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +148 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +151 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/AppleSignIn.swift +48 -0
- package/ios/Plugin/AppleSignInPlugin.swift +67 -0
- package/ios/Plugin/Classes/Options/SignInOptions.swift +31 -0
- package/ios/Plugin/Classes/Results/SignInResult.swift +46 -0
- package/ios/Plugin/Enums/CustomError.swift +26 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Protocols/Result.swift +6 -0
- package/package.json +93 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:width="24dp"
|
|
3
|
+
android:height="24dp"
|
|
4
|
+
android:viewportWidth="24"
|
|
5
|
+
android:viewportHeight="24">
|
|
6
|
+
<path
|
|
7
|
+
android:fillColor="#FF737373"
|
|
8
|
+
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
|
|
9
|
+
</vector>
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "AppleSignInPlugin",
|
|
4
|
+
"slug": "applesigninplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "initialize",
|
|
10
|
+
"signature": "(options: InitializeOptions) => Promise<void>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "InitializeOptions"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<void>",
|
|
19
|
+
"tags": [
|
|
20
|
+
{
|
|
21
|
+
"name": "since",
|
|
22
|
+
"text": "0.1.0"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"docs": "Initialize the plugin.\n\nThis method must be called before `signIn()` on **Android** and **Web**.\n\nOnly available on Android and Web.",
|
|
26
|
+
"complexTypes": [
|
|
27
|
+
"InitializeOptions"
|
|
28
|
+
],
|
|
29
|
+
"slug": "initialize"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "signIn",
|
|
33
|
+
"signature": "(options?: SignInOptions | undefined) => Promise<SignInResult>",
|
|
34
|
+
"parameters": [
|
|
35
|
+
{
|
|
36
|
+
"name": "options",
|
|
37
|
+
"docs": "",
|
|
38
|
+
"type": "SignInOptions | undefined"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"returns": "Promise<SignInResult>",
|
|
42
|
+
"tags": [
|
|
43
|
+
{
|
|
44
|
+
"name": "since",
|
|
45
|
+
"text": "0.1.0"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"docs": "Sign in with Apple.",
|
|
49
|
+
"complexTypes": [
|
|
50
|
+
"SignInResult",
|
|
51
|
+
"SignInOptions"
|
|
52
|
+
],
|
|
53
|
+
"slug": "signin"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"properties": []
|
|
57
|
+
},
|
|
58
|
+
"interfaces": [
|
|
59
|
+
{
|
|
60
|
+
"name": "InitializeOptions",
|
|
61
|
+
"slug": "initializeoptions",
|
|
62
|
+
"docs": "",
|
|
63
|
+
"tags": [
|
|
64
|
+
{
|
|
65
|
+
"text": "0.1.0",
|
|
66
|
+
"name": "since"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"methods": [],
|
|
70
|
+
"properties": [
|
|
71
|
+
{
|
|
72
|
+
"name": "clientId",
|
|
73
|
+
"tags": [
|
|
74
|
+
{
|
|
75
|
+
"text": "0.1.0",
|
|
76
|
+
"name": "since"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"text": "\"com.example.app.signin\"",
|
|
80
|
+
"name": "example"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"docs": "The Apple Service ID to use for sign-in.",
|
|
84
|
+
"complexTypes": [],
|
|
85
|
+
"type": "string"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "SignInResult",
|
|
91
|
+
"slug": "signinresult",
|
|
92
|
+
"docs": "",
|
|
93
|
+
"tags": [
|
|
94
|
+
{
|
|
95
|
+
"text": "0.1.0",
|
|
96
|
+
"name": "since"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"methods": [],
|
|
100
|
+
"properties": [
|
|
101
|
+
{
|
|
102
|
+
"name": "authorizationCode",
|
|
103
|
+
"tags": [
|
|
104
|
+
{
|
|
105
|
+
"text": "0.1.0",
|
|
106
|
+
"name": "since"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"docs": "The authorization code.",
|
|
110
|
+
"complexTypes": [],
|
|
111
|
+
"type": "string"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "idToken",
|
|
115
|
+
"tags": [
|
|
116
|
+
{
|
|
117
|
+
"text": "0.1.0",
|
|
118
|
+
"name": "since"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"docs": "The ID token (JWT).",
|
|
122
|
+
"complexTypes": [],
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "user",
|
|
127
|
+
"tags": [
|
|
128
|
+
{
|
|
129
|
+
"text": "0.1.0",
|
|
130
|
+
"name": "since"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"text": "\"001234.abcdef1234567890abcdef1234567890.1234\"",
|
|
134
|
+
"name": "example"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"docs": "The stable Apple user identifier.\n\nOn **Android** and **Web**, this is decoded from the JWT `sub` claim.",
|
|
138
|
+
"complexTypes": [],
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "email",
|
|
143
|
+
"tags": [
|
|
144
|
+
{
|
|
145
|
+
"text": "0.1.0",
|
|
146
|
+
"name": "since"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"docs": "The user's email address.\n\nOn **iOS**, this is only provided on the first sign-in.",
|
|
150
|
+
"complexTypes": [],
|
|
151
|
+
"type": "string | null"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "givenName",
|
|
155
|
+
"tags": [
|
|
156
|
+
{
|
|
157
|
+
"text": "0.1.0",
|
|
158
|
+
"name": "since"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"docs": "The user's given name.\n\nOn **iOS**, this is only provided on the first sign-in.",
|
|
162
|
+
"complexTypes": [],
|
|
163
|
+
"type": "string | null"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "familyName",
|
|
167
|
+
"tags": [
|
|
168
|
+
{
|
|
169
|
+
"text": "0.1.0",
|
|
170
|
+
"name": "since"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"docs": "The user's family name.\n\nOn **iOS**, this is only provided on the first sign-in.",
|
|
174
|
+
"complexTypes": [],
|
|
175
|
+
"type": "string | null"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "state",
|
|
179
|
+
"tags": [
|
|
180
|
+
{
|
|
181
|
+
"text": "0.1.0",
|
|
182
|
+
"name": "since"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"docs": "The state value from the sign-in request.\n\nOnly available on Android and Web.",
|
|
186
|
+
"complexTypes": [],
|
|
187
|
+
"type": "string | undefined"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "realUserStatus",
|
|
191
|
+
"tags": [
|
|
192
|
+
{
|
|
193
|
+
"text": "0.1.0",
|
|
194
|
+
"name": "since"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"docs": "The real user status.\n\nOnly available on iOS.",
|
|
198
|
+
"complexTypes": [
|
|
199
|
+
"RealUserStatus"
|
|
200
|
+
],
|
|
201
|
+
"type": "RealUserStatus"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"name": "SignInOptions",
|
|
207
|
+
"slug": "signinoptions",
|
|
208
|
+
"docs": "",
|
|
209
|
+
"tags": [
|
|
210
|
+
{
|
|
211
|
+
"text": "0.1.0",
|
|
212
|
+
"name": "since"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"methods": [],
|
|
216
|
+
"properties": [
|
|
217
|
+
{
|
|
218
|
+
"name": "redirectUrl",
|
|
219
|
+
"tags": [
|
|
220
|
+
{
|
|
221
|
+
"text": "0.1.0",
|
|
222
|
+
"name": "since"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"text": "\"https://example.com/callback\"",
|
|
226
|
+
"name": "example"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"docs": "The OAuth redirect URL to use for sign-in.\n\nOnly available on Android and Web.",
|
|
230
|
+
"complexTypes": [],
|
|
231
|
+
"type": "string | undefined"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "scopes",
|
|
235
|
+
"tags": [
|
|
236
|
+
{
|
|
237
|
+
"text": "0.1.0",
|
|
238
|
+
"name": "since"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"docs": "The scopes to request during sign-in.",
|
|
242
|
+
"complexTypes": [
|
|
243
|
+
"SignInScope"
|
|
244
|
+
],
|
|
245
|
+
"type": "SignInScope[] | undefined"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": "nonce",
|
|
249
|
+
"tags": [
|
|
250
|
+
{
|
|
251
|
+
"text": "0.1.0",
|
|
252
|
+
"name": "since"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"docs": "A nonce for replay protection.",
|
|
256
|
+
"complexTypes": [],
|
|
257
|
+
"type": "string | undefined"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"name": "state",
|
|
261
|
+
"tags": [
|
|
262
|
+
{
|
|
263
|
+
"text": "0.1.0",
|
|
264
|
+
"name": "since"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"docs": "A state value for CSRF protection.\n\nOnly available on Android and Web.",
|
|
268
|
+
"complexTypes": [],
|
|
269
|
+
"type": "string | undefined"
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"enums": [
|
|
275
|
+
{
|
|
276
|
+
"name": "RealUserStatus",
|
|
277
|
+
"slug": "realuserstatus",
|
|
278
|
+
"members": [
|
|
279
|
+
{
|
|
280
|
+
"name": "LikelyReal",
|
|
281
|
+
"value": "'LIKELY_REAL'",
|
|
282
|
+
"tags": [
|
|
283
|
+
{
|
|
284
|
+
"text": "0.1.0",
|
|
285
|
+
"name": "since"
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
"docs": "The user appears to be a real person."
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "Unknown",
|
|
292
|
+
"value": "'UNKNOWN'",
|
|
293
|
+
"tags": [
|
|
294
|
+
{
|
|
295
|
+
"text": "0.1.0",
|
|
296
|
+
"name": "since"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"docs": "The system can't determine whether the user is a real person."
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "Unsupported",
|
|
303
|
+
"value": "'UNSUPPORTED'",
|
|
304
|
+
"tags": [
|
|
305
|
+
{
|
|
306
|
+
"text": "0.1.0",
|
|
307
|
+
"name": "since"
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
"docs": "The real user status is not supported on this platform."
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "SignInScope",
|
|
316
|
+
"slug": "signinscope",
|
|
317
|
+
"members": [
|
|
318
|
+
{
|
|
319
|
+
"name": "Email",
|
|
320
|
+
"value": "'EMAIL'",
|
|
321
|
+
"tags": [
|
|
322
|
+
{
|
|
323
|
+
"text": "0.1.0",
|
|
324
|
+
"name": "since"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
"docs": "Request the user's email address."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "FullName",
|
|
331
|
+
"value": "'FULL_NAME'",
|
|
332
|
+
"tags": [
|
|
333
|
+
{
|
|
334
|
+
"text": "0.1.0",
|
|
335
|
+
"name": "since"
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
"docs": "Request the user's full name."
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"typeAliases": [],
|
|
344
|
+
"pluginConfigs": []
|
|
345
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
export interface AppleSignInPlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Initialize the plugin.
|
|
4
|
+
*
|
|
5
|
+
* This method must be called before `signIn()` on **Android** and **Web**.
|
|
6
|
+
*
|
|
7
|
+
* Only available on Android and Web.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
initialize(options: InitializeOptions): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Sign in with Apple.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
17
|
+
signIn(options?: SignInOptions): Promise<SignInResult>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
*/
|
|
22
|
+
export interface InitializeOptions {
|
|
23
|
+
/**
|
|
24
|
+
* The Apple Service ID to use for sign-in.
|
|
25
|
+
*
|
|
26
|
+
* @since 0.1.0
|
|
27
|
+
* @example "com.example.app.signin"
|
|
28
|
+
*/
|
|
29
|
+
clientId: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
*/
|
|
34
|
+
export interface SignInOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The OAuth redirect URL to use for sign-in.
|
|
37
|
+
*
|
|
38
|
+
* Only available on Android and Web.
|
|
39
|
+
*
|
|
40
|
+
* @since 0.1.0
|
|
41
|
+
* @example "https://example.com/callback"
|
|
42
|
+
*/
|
|
43
|
+
redirectUrl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The scopes to request during sign-in.
|
|
46
|
+
*
|
|
47
|
+
* @since 0.1.0
|
|
48
|
+
*/
|
|
49
|
+
scopes?: SignInScope[];
|
|
50
|
+
/**
|
|
51
|
+
* A nonce for replay protection.
|
|
52
|
+
*
|
|
53
|
+
* @since 0.1.0
|
|
54
|
+
*/
|
|
55
|
+
nonce?: string;
|
|
56
|
+
/**
|
|
57
|
+
* A state value for CSRF protection.
|
|
58
|
+
*
|
|
59
|
+
* Only available on Android and Web.
|
|
60
|
+
*
|
|
61
|
+
* @since 0.1.0
|
|
62
|
+
*/
|
|
63
|
+
state?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @since 0.1.0
|
|
67
|
+
*/
|
|
68
|
+
export interface SignInResult {
|
|
69
|
+
/**
|
|
70
|
+
* The authorization code.
|
|
71
|
+
*
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
*/
|
|
74
|
+
authorizationCode: string;
|
|
75
|
+
/**
|
|
76
|
+
* The ID token (JWT).
|
|
77
|
+
*
|
|
78
|
+
* @since 0.1.0
|
|
79
|
+
*/
|
|
80
|
+
idToken: string;
|
|
81
|
+
/**
|
|
82
|
+
* The stable Apple user identifier.
|
|
83
|
+
*
|
|
84
|
+
* On **Android** and **Web**, this is decoded from the JWT `sub` claim.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @example "001234.abcdef1234567890abcdef1234567890.1234"
|
|
88
|
+
*/
|
|
89
|
+
user: string;
|
|
90
|
+
/**
|
|
91
|
+
* The user's email address.
|
|
92
|
+
*
|
|
93
|
+
* On **iOS**, this is only provided on the first sign-in.
|
|
94
|
+
*
|
|
95
|
+
* @since 0.1.0
|
|
96
|
+
*/
|
|
97
|
+
email: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* The user's given name.
|
|
100
|
+
*
|
|
101
|
+
* On **iOS**, this is only provided on the first sign-in.
|
|
102
|
+
*
|
|
103
|
+
* @since 0.1.0
|
|
104
|
+
*/
|
|
105
|
+
givenName: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* The user's family name.
|
|
108
|
+
*
|
|
109
|
+
* On **iOS**, this is only provided on the first sign-in.
|
|
110
|
+
*
|
|
111
|
+
* @since 0.1.0
|
|
112
|
+
*/
|
|
113
|
+
familyName: string | null;
|
|
114
|
+
/**
|
|
115
|
+
* The state value from the sign-in request.
|
|
116
|
+
*
|
|
117
|
+
* Only available on Android and Web.
|
|
118
|
+
*
|
|
119
|
+
* @since 0.1.0
|
|
120
|
+
*/
|
|
121
|
+
state?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The real user status.
|
|
124
|
+
*
|
|
125
|
+
* Only available on iOS.
|
|
126
|
+
*
|
|
127
|
+
* @since 0.1.0
|
|
128
|
+
*/
|
|
129
|
+
realUserStatus?: RealUserStatus;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @since 0.1.0
|
|
133
|
+
*/
|
|
134
|
+
export declare enum SignInScope {
|
|
135
|
+
/**
|
|
136
|
+
* Request the user's email address.
|
|
137
|
+
*
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
*/
|
|
140
|
+
Email = "EMAIL",
|
|
141
|
+
/**
|
|
142
|
+
* Request the user's full name.
|
|
143
|
+
*
|
|
144
|
+
* @since 0.1.0
|
|
145
|
+
*/
|
|
146
|
+
FullName = "FULL_NAME"
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @since 0.1.0
|
|
150
|
+
*/
|
|
151
|
+
export declare enum RealUserStatus {
|
|
152
|
+
/**
|
|
153
|
+
* The user appears to be a real person.
|
|
154
|
+
*
|
|
155
|
+
* @since 0.1.0
|
|
156
|
+
*/
|
|
157
|
+
LikelyReal = "LIKELY_REAL",
|
|
158
|
+
/**
|
|
159
|
+
* The system can't determine whether the user is a real person.
|
|
160
|
+
*
|
|
161
|
+
* @since 0.1.0
|
|
162
|
+
*/
|
|
163
|
+
Unknown = "UNKNOWN",
|
|
164
|
+
/**
|
|
165
|
+
* The real user status is not supported on this platform.
|
|
166
|
+
*
|
|
167
|
+
* @since 0.1.0
|
|
168
|
+
*/
|
|
169
|
+
Unsupported = "UNSUPPORTED"
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @since 0.1.0
|
|
173
|
+
*/
|
|
174
|
+
export declare enum ErrorCode {
|
|
175
|
+
/**
|
|
176
|
+
* The sign-in was canceled by the user.
|
|
177
|
+
*
|
|
178
|
+
* @since 0.1.0
|
|
179
|
+
*/
|
|
180
|
+
SignInCanceled = "SIGN_IN_CANCELED"
|
|
181
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 0.1.0
|
|
3
|
+
*/
|
|
4
|
+
export var SignInScope;
|
|
5
|
+
(function (SignInScope) {
|
|
6
|
+
/**
|
|
7
|
+
* Request the user's email address.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
SignInScope["Email"] = "EMAIL";
|
|
12
|
+
/**
|
|
13
|
+
* Request the user's full name.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
17
|
+
SignInScope["FullName"] = "FULL_NAME";
|
|
18
|
+
})(SignInScope || (SignInScope = {}));
|
|
19
|
+
/**
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
*/
|
|
22
|
+
export var RealUserStatus;
|
|
23
|
+
(function (RealUserStatus) {
|
|
24
|
+
/**
|
|
25
|
+
* The user appears to be a real person.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
*/
|
|
29
|
+
RealUserStatus["LikelyReal"] = "LIKELY_REAL";
|
|
30
|
+
/**
|
|
31
|
+
* The system can't determine whether the user is a real person.
|
|
32
|
+
*
|
|
33
|
+
* @since 0.1.0
|
|
34
|
+
*/
|
|
35
|
+
RealUserStatus["Unknown"] = "UNKNOWN";
|
|
36
|
+
/**
|
|
37
|
+
* The real user status is not supported on this platform.
|
|
38
|
+
*
|
|
39
|
+
* @since 0.1.0
|
|
40
|
+
*/
|
|
41
|
+
RealUserStatus["Unsupported"] = "UNSUPPORTED";
|
|
42
|
+
})(RealUserStatus || (RealUserStatus = {}));
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.1.0
|
|
45
|
+
*/
|
|
46
|
+
export var ErrorCode;
|
|
47
|
+
(function (ErrorCode) {
|
|
48
|
+
/**
|
|
49
|
+
* The sign-in was canceled by the user.
|
|
50
|
+
*
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
*/
|
|
53
|
+
ErrorCode["SignInCanceled"] = "SIGN_IN_CANCELED";
|
|
54
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
55
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsIA;;GAEG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB;;;;OAIG;IACH,8BAAe,CAAA;IACf;;;;OAIG;IACH,qCAAsB,CAAA;AACxB,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAmBX;AAnBD,WAAY,cAAc;IACxB;;;;OAIG;IACH,4CAA0B,CAAA;IAC1B;;;;OAIG;IACH,qCAAmB,CAAA;IACnB;;;;OAIG;IACH,6CAA2B,CAAA;AAC7B,CAAC,EAnBW,cAAc,KAAd,cAAc,QAmBzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB;;;;OAIG;IACH,gDAAmC,CAAA;AACrC,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB","sourcesContent":["export interface AppleSignInPlugin {\n /**\n * Initialize the plugin.\n *\n * This method must be called before `signIn()` on **Android** and **Web**.\n *\n * Only available on Android and Web.\n *\n * @since 0.1.0\n */\n initialize(options: InitializeOptions): Promise<void>;\n /**\n * Sign in with Apple.\n *\n * @since 0.1.0\n */\n signIn(options?: SignInOptions): Promise<SignInResult>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface InitializeOptions {\n /**\n * The Apple Service ID to use for sign-in.\n *\n * @since 0.1.0\n * @example \"com.example.app.signin\"\n */\n clientId: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface SignInOptions {\n /**\n * The OAuth redirect URL to use for sign-in.\n *\n * Only available on Android and Web.\n *\n * @since 0.1.0\n * @example \"https://example.com/callback\"\n */\n redirectUrl?: string;\n /**\n * The scopes to request during sign-in.\n *\n * @since 0.1.0\n */\n scopes?: SignInScope[];\n /**\n * A nonce for replay protection.\n *\n * @since 0.1.0\n */\n nonce?: string;\n /**\n * A state value for CSRF protection.\n *\n * Only available on Android and Web.\n *\n * @since 0.1.0\n */\n state?: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface SignInResult {\n /**\n * The authorization code.\n *\n * @since 0.1.0\n */\n authorizationCode: string;\n /**\n * The ID token (JWT).\n *\n * @since 0.1.0\n */\n idToken: string;\n /**\n * The stable Apple user identifier.\n *\n * On **Android** and **Web**, this is decoded from the JWT `sub` claim.\n *\n * @since 0.1.0\n * @example \"001234.abcdef1234567890abcdef1234567890.1234\"\n */\n user: string;\n /**\n * The user's email address.\n *\n * On **iOS**, this is only provided on the first sign-in.\n *\n * @since 0.1.0\n */\n email: string | null;\n /**\n * The user's given name.\n *\n * On **iOS**, this is only provided on the first sign-in.\n *\n * @since 0.1.0\n */\n givenName: string | null;\n /**\n * The user's family name.\n *\n * On **iOS**, this is only provided on the first sign-in.\n *\n * @since 0.1.0\n */\n familyName: string | null;\n /**\n * The state value from the sign-in request.\n *\n * Only available on Android and Web.\n *\n * @since 0.1.0\n */\n state?: string;\n /**\n * The real user status.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n realUserStatus?: RealUserStatus;\n}\n\n/**\n * @since 0.1.0\n */\nexport enum SignInScope {\n /**\n * Request the user's email address.\n *\n * @since 0.1.0\n */\n Email = 'EMAIL',\n /**\n * Request the user's full name.\n *\n * @since 0.1.0\n */\n FullName = 'FULL_NAME',\n}\n\n/**\n * @since 0.1.0\n */\nexport enum RealUserStatus {\n /**\n * The user appears to be a real person.\n *\n * @since 0.1.0\n */\n LikelyReal = 'LIKELY_REAL',\n /**\n * The system can't determine whether the user is a real person.\n *\n * @since 0.1.0\n */\n Unknown = 'UNKNOWN',\n /**\n * The real user status is not supported on this platform.\n *\n * @since 0.1.0\n */\n Unsupported = 'UNSUPPORTED',\n}\n\n/**\n * @since 0.1.0\n */\nexport enum ErrorCode {\n /**\n * The sign-in was canceled by the user.\n *\n * @since 0.1.0\n */\n SignInCanceled = 'SIGN_IN_CANCELED',\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const AppleSignIn = registerPlugin('AppleSignIn', {
|
|
3
|
+
web: () => import('./web').then(m => new m.AppleSignInWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { AppleSignIn };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,WAAW,GAAG,cAAc,CAAoB,aAAa,EAAE;IACnE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;CAC7D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { AppleSignInPlugin } from './definitions';\n\nconst AppleSignIn = registerPlugin<AppleSignInPlugin>('AppleSignIn', {\n web: () => import('./web').then(m => new m.AppleSignInWeb()),\n});\n\nexport * from './definitions';\nexport { AppleSignIn };\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { AppleSignInPlugin, InitializeOptions, SignInOptions, SignInResult } from './definitions';
|
|
3
|
+
export declare class AppleSignInWeb extends WebPlugin implements AppleSignInPlugin {
|
|
4
|
+
private clientId;
|
|
5
|
+
private scriptLoaded;
|
|
6
|
+
initialize(options: InitializeOptions): Promise<void>;
|
|
7
|
+
signIn(options?: SignInOptions): Promise<SignInResult>;
|
|
8
|
+
private decodeJwtPayload;
|
|
9
|
+
private loadScript;
|
|
10
|
+
}
|