@capawesome/capacitor-app-integrity 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.
Files changed (45) hide show
  1. package/CapawesomeCapacitorAppIntegrity.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +28 -0
  4. package/README.md +385 -0
  5. package/android/build.gradle +60 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/AppIntegrity.java +208 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/AppIntegrityPlugin.java +137 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/classes/CustomException.java +20 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/classes/CustomExceptions.java +11 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/classes/options/PrepareIntegrityTokenOptions.java +26 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/classes/options/RequestIntegrityTokenOptions.java +51 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/classes/results/IsAvailableResult.java +22 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/classes/results/RequestIntegrityTokenResult.java +23 -0
  15. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/interfaces/Callback.java +5 -0
  16. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/interfaces/EmptyCallback.java +5 -0
  17. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/interfaces/NonEmptyResultCallback.java +7 -0
  18. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appintegrity/interfaces/Result.java +7 -0
  19. package/android/src/main/res/.gitkeep +0 -0
  20. package/dist/docs.json +472 -0
  21. package/dist/esm/definitions.d.ts +384 -0
  22. package/dist/esm/definitions.js +152 -0
  23. package/dist/esm/definitions.js.map +1 -0
  24. package/dist/esm/index.d.ts +4 -0
  25. package/dist/esm/index.js +7 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/web.d.ts +10 -0
  28. package/dist/esm/web.js +22 -0
  29. package/dist/esm/web.js.map +1 -0
  30. package/dist/plugin.cjs.js +188 -0
  31. package/dist/plugin.cjs.js.map +1 -0
  32. package/dist/plugin.js +191 -0
  33. package/dist/plugin.js.map +1 -0
  34. package/ios/Plugin/AppIntegrity.swift +78 -0
  35. package/ios/Plugin/AppIntegrityPlugin.swift +116 -0
  36. package/ios/Plugin/Classes/Options/AttestKeyOptions.swift +29 -0
  37. package/ios/Plugin/Classes/Options/GenerateAssertionOptions.swift +29 -0
  38. package/ios/Plugin/Classes/Results/AttestKeyResult.swift +16 -0
  39. package/ios/Plugin/Classes/Results/GenerateAssertionResult.swift +16 -0
  40. package/ios/Plugin/Classes/Results/GenerateKeyResult.swift +16 -0
  41. package/ios/Plugin/Classes/Results/IsAvailableResult.swift +16 -0
  42. package/ios/Plugin/Enums/CustomError.swift +59 -0
  43. package/ios/Plugin/Info.plist +24 -0
  44. package/ios/Plugin/Protocols/Result.swift +5 -0
  45. package/package.json +91 -0
package/dist/docs.json ADDED
@@ -0,0 +1,472 @@
1
+ {
2
+ "api": {
3
+ "name": "AppIntegrityPlugin",
4
+ "slug": "appintegrityplugin",
5
+ "docs": "",
6
+ "tags": [
7
+ {
8
+ "text": "0.1.0",
9
+ "name": "since"
10
+ }
11
+ ],
12
+ "methods": [
13
+ {
14
+ "name": "attestKey",
15
+ "signature": "(options: AttestKeyOptions) => Promise<AttestKeyResult>",
16
+ "parameters": [
17
+ {
18
+ "name": "options",
19
+ "docs": "",
20
+ "type": "AttestKeyOptions"
21
+ }
22
+ ],
23
+ "returns": "Promise<AttestKeyResult>",
24
+ "tags": [
25
+ {
26
+ "name": "since",
27
+ "text": "0.1.0"
28
+ }
29
+ ],
30
+ "docs": "Attest a key generated with `generateKey()` using Apple's App Attest service.\n\nThe returned attestation object must be sent to your server, which verifies\nit with Apple and stores the key identifier for future assertions.\n\nOnly available on iOS.",
31
+ "complexTypes": [
32
+ "AttestKeyResult",
33
+ "AttestKeyOptions"
34
+ ],
35
+ "slug": "attestkey"
36
+ },
37
+ {
38
+ "name": "generateAssertion",
39
+ "signature": "(options: GenerateAssertionOptions) => Promise<GenerateAssertionResult>",
40
+ "parameters": [
41
+ {
42
+ "name": "options",
43
+ "docs": "",
44
+ "type": "GenerateAssertionOptions"
45
+ }
46
+ ],
47
+ "returns": "Promise<GenerateAssertionResult>",
48
+ "tags": [
49
+ {
50
+ "name": "since",
51
+ "text": "0.1.0"
52
+ }
53
+ ],
54
+ "docs": "Generate an assertion for the given client data using an attested key.\n\nThe returned assertion must be sent to your server along with the client\ndata, where it is verified using the previously stored key identifier.\n\nOnly available on iOS.",
55
+ "complexTypes": [
56
+ "GenerateAssertionResult",
57
+ "GenerateAssertionOptions"
58
+ ],
59
+ "slug": "generateassertion"
60
+ },
61
+ {
62
+ "name": "generateKey",
63
+ "signature": "() => Promise<GenerateKeyResult>",
64
+ "parameters": [],
65
+ "returns": "Promise<GenerateKeyResult>",
66
+ "tags": [
67
+ {
68
+ "name": "since",
69
+ "text": "0.1.0"
70
+ }
71
+ ],
72
+ "docs": "Generate a new App Attest key pair.\n\nThe private key is stored in the Secure Enclave. Store the returned key\nidentifier in your app to attest the key and generate assertions later.\n\nOnly available on iOS.",
73
+ "complexTypes": [
74
+ "GenerateKeyResult"
75
+ ],
76
+ "slug": "generatekey"
77
+ },
78
+ {
79
+ "name": "isAvailable",
80
+ "signature": "() => Promise<IsAvailableResult>",
81
+ "parameters": [],
82
+ "returns": "Promise<IsAvailableResult>",
83
+ "tags": [
84
+ {
85
+ "name": "since",
86
+ "text": "0.1.0"
87
+ }
88
+ ],
89
+ "docs": "Check whether app integrity attestation is available on this device.\n\nOn Android, this checks whether Google Play Services is available.\nOn iOS, this checks whether the App Attest service is supported.\nOn iOS, the App Attest service is not supported on simulators.",
90
+ "complexTypes": [
91
+ "IsAvailableResult"
92
+ ],
93
+ "slug": "isavailable"
94
+ },
95
+ {
96
+ "name": "prepareIntegrityToken",
97
+ "signature": "(options: PrepareIntegrityTokenOptions) => Promise<void>",
98
+ "parameters": [
99
+ {
100
+ "name": "options",
101
+ "docs": "",
102
+ "type": "PrepareIntegrityTokenOptions"
103
+ }
104
+ ],
105
+ "returns": "Promise<void>",
106
+ "tags": [
107
+ {
108
+ "name": "since",
109
+ "text": "0.1.0"
110
+ }
111
+ ],
112
+ "docs": "Prepare the integrity token provider for standard integrity token requests.\n\nCall this method once, for example at app start, before calling\n`requestIntegrityToken(...)` with a request hash. The preparation can take\nseveral seconds, so it should be done well ahead of the first request.\n\nOnly available on Android.",
113
+ "complexTypes": [
114
+ "PrepareIntegrityTokenOptions"
115
+ ],
116
+ "slug": "prepareintegritytoken"
117
+ },
118
+ {
119
+ "name": "requestIntegrityToken",
120
+ "signature": "(options: RequestIntegrityTokenOptions) => Promise<RequestIntegrityTokenResult>",
121
+ "parameters": [
122
+ {
123
+ "name": "options",
124
+ "docs": "",
125
+ "type": "RequestIntegrityTokenOptions"
126
+ }
127
+ ],
128
+ "returns": "Promise<RequestIntegrityTokenResult>",
129
+ "tags": [
130
+ {
131
+ "name": "since",
132
+ "text": "0.1.0"
133
+ }
134
+ ],
135
+ "docs": "Request an integrity token from the Play Integrity API.\n\nProvide a `requestHash` for a standard request (recommended, requires a\nprior call to `prepareIntegrityToken(...)`) or a `nonce` for a classic request.\n\nThe returned token must be sent to your server, which decrypts and\nverifies it via Google's servers.\n\nOnly available on Android.",
136
+ "complexTypes": [
137
+ "RequestIntegrityTokenResult",
138
+ "RequestIntegrityTokenOptions"
139
+ ],
140
+ "slug": "requestintegritytoken"
141
+ }
142
+ ],
143
+ "properties": []
144
+ },
145
+ "interfaces": [
146
+ {
147
+ "name": "AttestKeyResult",
148
+ "slug": "attestkeyresult",
149
+ "docs": "",
150
+ "tags": [
151
+ {
152
+ "text": "0.1.0",
153
+ "name": "since"
154
+ }
155
+ ],
156
+ "methods": [],
157
+ "properties": [
158
+ {
159
+ "name": "attestationObject",
160
+ "tags": [
161
+ {
162
+ "text": "0.1.0",
163
+ "name": "since"
164
+ }
165
+ ],
166
+ "docs": "The attestation object, encoded as a base64 string.\n\nSend this to your server for verification with Apple.",
167
+ "complexTypes": [],
168
+ "type": "string"
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ "name": "AttestKeyOptions",
174
+ "slug": "attestkeyoptions",
175
+ "docs": "",
176
+ "tags": [
177
+ {
178
+ "text": "0.1.0",
179
+ "name": "since"
180
+ }
181
+ ],
182
+ "methods": [],
183
+ "properties": [
184
+ {
185
+ "name": "challenge",
186
+ "tags": [
187
+ {
188
+ "text": "'dGhpc2lzYWNoYWxsZW5nZQ=='",
189
+ "name": "example"
190
+ },
191
+ {
192
+ "text": "0.1.0",
193
+ "name": "since"
194
+ }
195
+ ],
196
+ "docs": "The one-time challenge received from your server, encoded as a\nbase64 string.\n\nThe challenge is hashed with SHA-256 on the device before it is passed\nto the App Attest service.",
197
+ "complexTypes": [],
198
+ "type": "string"
199
+ },
200
+ {
201
+ "name": "keyId",
202
+ "tags": [
203
+ {
204
+ "text": "'Kh0DIEwVJTDJUyIRZ4M9BvJn/i4RSSGDkFvUZOaSm5g='",
205
+ "name": "example"
206
+ },
207
+ {
208
+ "text": "0.1.0",
209
+ "name": "since"
210
+ }
211
+ ],
212
+ "docs": "The identifier of the key to attest, as returned by `generateKey()`.",
213
+ "complexTypes": [],
214
+ "type": "string"
215
+ }
216
+ ]
217
+ },
218
+ {
219
+ "name": "GenerateAssertionResult",
220
+ "slug": "generateassertionresult",
221
+ "docs": "",
222
+ "tags": [
223
+ {
224
+ "text": "0.1.0",
225
+ "name": "since"
226
+ }
227
+ ],
228
+ "methods": [],
229
+ "properties": [
230
+ {
231
+ "name": "assertion",
232
+ "tags": [
233
+ {
234
+ "text": "0.1.0",
235
+ "name": "since"
236
+ }
237
+ ],
238
+ "docs": "The assertion object, encoded as a base64 string.\n\nSend this to your server for verification.",
239
+ "complexTypes": [],
240
+ "type": "string"
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "name": "GenerateAssertionOptions",
246
+ "slug": "generateassertionoptions",
247
+ "docs": "",
248
+ "tags": [
249
+ {
250
+ "text": "0.1.0",
251
+ "name": "since"
252
+ }
253
+ ],
254
+ "methods": [],
255
+ "properties": [
256
+ {
257
+ "name": "clientData",
258
+ "tags": [
259
+ {
260
+ "text": "'eyJjaGFsbGVuZ2UiOiJkR2hwYzJsellXTm9ZV3hzWlc1blpRPT0ifQ=='",
261
+ "name": "example"
262
+ },
263
+ {
264
+ "text": "0.1.0",
265
+ "name": "since"
266
+ }
267
+ ],
268
+ "docs": "The client data to sign, encoded as a base64 string.\n\nThis is usually a JSON payload that includes a one-time challenge\nreceived from your server. The client data is hashed with SHA-256 on the\ndevice before it is passed to the App Attest service.",
269
+ "complexTypes": [],
270
+ "type": "string"
271
+ },
272
+ {
273
+ "name": "keyId",
274
+ "tags": [
275
+ {
276
+ "text": "'Kh0DIEwVJTDJUyIRZ4M9BvJn/i4RSSGDkFvUZOaSm5g='",
277
+ "name": "example"
278
+ },
279
+ {
280
+ "text": "0.1.0",
281
+ "name": "since"
282
+ }
283
+ ],
284
+ "docs": "The identifier of an attested key, as returned by `generateKey()`.",
285
+ "complexTypes": [],
286
+ "type": "string"
287
+ }
288
+ ]
289
+ },
290
+ {
291
+ "name": "GenerateKeyResult",
292
+ "slug": "generatekeyresult",
293
+ "docs": "",
294
+ "tags": [
295
+ {
296
+ "text": "0.1.0",
297
+ "name": "since"
298
+ }
299
+ ],
300
+ "methods": [],
301
+ "properties": [
302
+ {
303
+ "name": "keyId",
304
+ "tags": [
305
+ {
306
+ "text": "'Kh0DIEwVJTDJUyIRZ4M9BvJn/i4RSSGDkFvUZOaSm5g='",
307
+ "name": "example"
308
+ },
309
+ {
310
+ "text": "0.1.0",
311
+ "name": "since"
312
+ }
313
+ ],
314
+ "docs": "The identifier of the generated key pair.",
315
+ "complexTypes": [],
316
+ "type": "string"
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "name": "IsAvailableResult",
322
+ "slug": "isavailableresult",
323
+ "docs": "",
324
+ "tags": [
325
+ {
326
+ "text": "0.1.0",
327
+ "name": "since"
328
+ }
329
+ ],
330
+ "methods": [],
331
+ "properties": [
332
+ {
333
+ "name": "available",
334
+ "tags": [
335
+ {
336
+ "text": "true",
337
+ "name": "example"
338
+ },
339
+ {
340
+ "text": "0.1.0",
341
+ "name": "since"
342
+ }
343
+ ],
344
+ "docs": "Whether app integrity attestation is available on this device.",
345
+ "complexTypes": [],
346
+ "type": "boolean"
347
+ }
348
+ ]
349
+ },
350
+ {
351
+ "name": "PrepareIntegrityTokenOptions",
352
+ "slug": "prepareintegritytokenoptions",
353
+ "docs": "",
354
+ "tags": [
355
+ {
356
+ "text": "0.1.0",
357
+ "name": "since"
358
+ }
359
+ ],
360
+ "methods": [],
361
+ "properties": [
362
+ {
363
+ "name": "cloudProjectNumber",
364
+ "tags": [
365
+ {
366
+ "text": "123456789012",
367
+ "name": "example"
368
+ },
369
+ {
370
+ "text": "0.1.0",
371
+ "name": "since"
372
+ }
373
+ ],
374
+ "docs": "The Google Cloud project number of the project that is linked\nto your Play Console developer account.",
375
+ "complexTypes": [],
376
+ "type": "number"
377
+ }
378
+ ]
379
+ },
380
+ {
381
+ "name": "RequestIntegrityTokenResult",
382
+ "slug": "requestintegritytokenresult",
383
+ "docs": "",
384
+ "tags": [
385
+ {
386
+ "text": "0.1.0",
387
+ "name": "since"
388
+ }
389
+ ],
390
+ "methods": [],
391
+ "properties": [
392
+ {
393
+ "name": "token",
394
+ "tags": [
395
+ {
396
+ "text": "0.1.0",
397
+ "name": "since"
398
+ }
399
+ ],
400
+ "docs": "The integrity token.\n\nSend this to your server, which decrypts and verifies it via\nGoogle's servers.",
401
+ "complexTypes": [],
402
+ "type": "string"
403
+ }
404
+ ]
405
+ },
406
+ {
407
+ "name": "RequestIntegrityTokenOptions",
408
+ "slug": "requestintegritytokenoptions",
409
+ "docs": "",
410
+ "tags": [
411
+ {
412
+ "text": "0.1.0",
413
+ "name": "since"
414
+ }
415
+ ],
416
+ "methods": [],
417
+ "properties": [
418
+ {
419
+ "name": "cloudProjectNumber",
420
+ "tags": [
421
+ {
422
+ "text": "123456789012",
423
+ "name": "example"
424
+ },
425
+ {
426
+ "text": "0.1.0",
427
+ "name": "since"
428
+ }
429
+ ],
430
+ "docs": "The Google Cloud project number of the project that is linked\nto your Play Console developer account.\n\nOnly used for classic requests. It is required if your app is\ndistributed outside of Google Play.",
431
+ "complexTypes": [],
432
+ "type": "number | undefined"
433
+ },
434
+ {
435
+ "name": "nonce",
436
+ "tags": [
437
+ {
438
+ "text": "'dGhpc2lzYW5vbmNl'",
439
+ "name": "example"
440
+ },
441
+ {
442
+ "text": "0.1.0",
443
+ "name": "since"
444
+ }
445
+ ],
446
+ "docs": "The one-time nonce for a classic request, encoded as a base64\nweb-safe no-wrap string.\n\nProvide either `nonce` or `requestHash`.",
447
+ "complexTypes": [],
448
+ "type": "string | undefined"
449
+ },
450
+ {
451
+ "name": "requestHash",
452
+ "tags": [
453
+ {
454
+ "text": "'2cp24z...'",
455
+ "name": "example"
456
+ },
457
+ {
458
+ "text": "0.1.0",
459
+ "name": "since"
460
+ }
461
+ ],
462
+ "docs": "The request hash for a standard request.\n\nRequires a prior call to `prepareIntegrityToken(...)`.\n\nProvide either `nonce` or `requestHash`.",
463
+ "complexTypes": [],
464
+ "type": "string | undefined"
465
+ }
466
+ ]
467
+ }
468
+ ],
469
+ "enums": [],
470
+ "typeAliases": [],
471
+ "pluginConfigs": []
472
+ }