@cap-kit/tls-fingerprint 8.0.0

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 (51) hide show
  1. package/CapKitTlsFingerprint.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +25 -0
  4. package/README.md +427 -0
  5. package/android/build.gradle +103 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/java/io/capkit/settings/TLSFingerprintImpl.kt +333 -0
  8. package/android/src/main/java/io/capkit/settings/TLSFingerprintPlugin.kt +342 -0
  9. package/android/src/main/java/io/capkit/settings/config/TLSFingerprintConfig.kt +102 -0
  10. package/android/src/main/java/io/capkit/settings/error/TLSFingerprintError.kt +114 -0
  11. package/android/src/main/java/io/capkit/settings/error/TLSFingerprintErrorMessages.kt +27 -0
  12. package/android/src/main/java/io/capkit/settings/logger/TLSFingerprintLogger.kt +85 -0
  13. package/android/src/main/java/io/capkit/settings/model/TLSFingerprintResultModel.kt +32 -0
  14. package/android/src/main/java/io/capkit/settings/utils/TLSFingerprintUtils.kt +91 -0
  15. package/android/src/main/res/.gitkeep +0 -0
  16. package/dist/cli/fingerprint.js +163 -0
  17. package/dist/cli/fingerprint.js.map +1 -0
  18. package/dist/docs.json +386 -0
  19. package/dist/esm/cli/fingerprint.d.ts +1 -0
  20. package/dist/esm/cli/fingerprint.js +161 -0
  21. package/dist/esm/cli/fingerprint.js.map +1 -0
  22. package/dist/esm/definitions.d.ts +244 -0
  23. package/dist/esm/definitions.js +42 -0
  24. package/dist/esm/definitions.js.map +1 -0
  25. package/dist/esm/index.d.ts +13 -0
  26. package/dist/esm/index.js +11 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/version.d.ts +1 -0
  29. package/dist/esm/version.js +3 -0
  30. package/dist/esm/version.js.map +1 -0
  31. package/dist/esm/web.d.ts +33 -0
  32. package/dist/esm/web.js +47 -0
  33. package/dist/esm/web.js.map +1 -0
  34. package/dist/plugin.cjs +107 -0
  35. package/dist/plugin.cjs.map +1 -0
  36. package/dist/plugin.js +110 -0
  37. package/dist/plugin.js.map +1 -0
  38. package/ios/Sources/TLSFingerprintPlugin/TLSFingerprintDelegate.swift +365 -0
  39. package/ios/Sources/TLSFingerprintPlugin/TLSFingerprintImpl.swift +275 -0
  40. package/ios/Sources/TLSFingerprintPlugin/TLSFingerprintPlugin.swift +219 -0
  41. package/ios/Sources/TLSFingerprintPlugin/Version.swift +16 -0
  42. package/ios/Sources/TLSFingerprintPlugin/config/TLSFingerprintConfig.swift +114 -0
  43. package/ios/Sources/TLSFingerprintPlugin/error/TLSFingerprintError.swift +107 -0
  44. package/ios/Sources/TLSFingerprintPlugin/error/TLSFingerprintErrorMessages.swift +30 -0
  45. package/ios/Sources/TLSFingerprintPlugin/logger/TLSFingerprintLogger.swift +69 -0
  46. package/ios/Sources/TLSFingerprintPlugin/model/TLSFingerprintResult.swift +76 -0
  47. package/ios/Sources/TLSFingerprintPlugin/utils/TLSFingerprintUtils.swift +79 -0
  48. package/ios/Tests/TLSFingerprintPluginTests/TLSFingerprintPluginTests.swift +15 -0
  49. package/package.json +131 -0
  50. package/scripts/chmod.mjs +34 -0
  51. package/scripts/sync-version.mjs +68 -0
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Capacitor configuration extension for the TLSFingerprint plugin.
3
+ *
4
+ * Configuration values defined here can be provided under the
5
+ * `plugins.TLSFingerprint` key inside `capacitor.config.ts`.
6
+ *
7
+ * These values are:
8
+ * - read natively at build/runtime
9
+ * - NOT accessible from JavaScript at runtime
10
+ * - treated as read-only static configuration
11
+ *
12
+ * @see https://capacitorjs.com/docs/plugins/configuration-values
13
+ */
14
+ declare module '@capacitor/cli' {
15
+ interface PluginsConfig {
16
+ /**
17
+ * Configuration options for the TLSFingerprint plugin.
18
+ */
19
+ TLSFingerprint?: TLSFingerprintConfig;
20
+ }
21
+ }
22
+ /**
23
+ * Standardized error codes for programmatic handling of TLS fingerprint failures.
24
+ *
25
+ * Errors are delivered via Promise rejection as `CapacitorException`
26
+ * with one of the following codes.
27
+ *
28
+ * @since 8.0.0
29
+ */
30
+ export declare enum TLSFingerprintErrorCode {
31
+ /** Required data is missing or the feature is not available. */
32
+ UNAVAILABLE = "UNAVAILABLE",
33
+ /** The user cancelled an interactive flow. */
34
+ CANCELLED = "CANCELLED",
35
+ /** The user denied a required permission or the feature is disabled. */
36
+ PERMISSION_DENIED = "PERMISSION_DENIED",
37
+ /** The TLS fingerprint operation failed due to a runtime or initialization error. */
38
+ INIT_FAILED = "INIT_FAILED",
39
+ /** The input provided to the plugin method is invalid, missing, or malformed. */
40
+ INVALID_INPUT = "INVALID_INPUT",
41
+ /** Invalid or unsupported input was provided. */
42
+ UNKNOWN_TYPE = "UNKNOWN_TYPE",
43
+ /** The requested resource does not exist. */
44
+ NOT_FOUND = "NOT_FOUND",
45
+ /** The operation conflicts with the current state. */
46
+ CONFLICT = "CONFLICT",
47
+ /** The operation did not complete within the expected time. */
48
+ TIMEOUT = "TIMEOUT",
49
+ /** The server certificate fingerprint did not match any expected fingerprint. */
50
+ PINNING_FAILED = "PINNING_FAILED",
51
+ /** The request host matched an excluded domain. */
52
+ EXCLUDED_DOMAIN = "EXCLUDED_DOMAIN",
53
+ /** Network connectivity or TLS handshake error. */
54
+ NETWORK_ERROR = "NETWORK_ERROR",
55
+ /** SSL/TLS specific error (certificate expired, handshake failure, etc.). */
56
+ SSL_ERROR = "SSL_ERROR"
57
+ }
58
+ /**
59
+ * Static configuration options for the TLSFingerprint plugin.
60
+ *
61
+ * These values can be defined in `capacitor.config.ts` and are used
62
+ * natively as fallback values when runtime options are not provided.
63
+ */
64
+ export interface TLSFingerprintConfig {
65
+ /**
66
+ * Enables verbose native logging.
67
+ *
68
+ * When enabled, additional debug information is printed
69
+ * to the native console (Logcat on Android, Xcode on iOS).
70
+ *
71
+ * This option affects native logging behavior only and
72
+ * has no impact on the JavaScript API.
73
+ *
74
+ * @default false
75
+ * @example true
76
+ * @since 8.0.0
77
+ */
78
+ verboseLogging?: boolean;
79
+ /**
80
+ * Default fingerprint used by `checkCertificate()` when
81
+ * `options.fingerprint` is not provided at runtime.
82
+ *
83
+ * @example "50:4B:A1:B5:48:96:71:F3:9F:87:7E:0A:09:FD:3E:1B:C0:4F:AA:9F:FC:83:3E:A9:3A:00:78:88:F8:BA:60:26"
84
+ * @since 8.0.0
85
+ */
86
+ fingerprint?: string;
87
+ /**
88
+ * Default fingerprints used by `checkCertificates()` when
89
+ * `options.fingerprints` is not provided at runtime.
90
+ *
91
+ * @example ["50:4B:A1:B5:48:96:71:F3:9F:87:7E:0A:09:FD:3E:1B:C0:4F:AA:9F:FC:83:3E:A9:3A:00:78:88:F8:BA:60:26"]
92
+ * @since 8.0.0
93
+ */
94
+ fingerprints?: string[];
95
+ /**
96
+ * Domains to bypass. Matches exact domain or subdomains.
97
+ * Do not include schemes or paths.
98
+ *
99
+ * @since 8.0.0
100
+ */
101
+ excludedDomains?: string[];
102
+ }
103
+ /**
104
+ * Options for checking a single SSL certificate.
105
+ */
106
+ export interface TLSFingerprintOptions {
107
+ /**
108
+ * HTTPS URL of the server whose SSL certificate must be checked.
109
+ *
110
+ * This value is REQUIRED and cannot be provided via configuration.
111
+ *
112
+ * @example "https://example.com"
113
+ */
114
+ url: string;
115
+ /**
116
+ * Expected SHA-256 fingerprint of the certificate.
117
+ *
118
+ * Resolution order:
119
+ * 1. `options.fingerprint` (runtime)
120
+ * 2. `plugins.TLSFingerprint.fingerprint` (config)
121
+ *
122
+ * If neither is provided, the Promise is rejected with
123
+ * `TLSFingerprintErrorCode.UNAVAILABLE`.
124
+ */
125
+ fingerprint?: string;
126
+ }
127
+ /**
128
+ * Options for checking an SSL certificate using multiple allowed fingerprints.
129
+ */
130
+ export interface TLSFingerprintMultiOptions {
131
+ /**
132
+ * HTTPS URL of the server whose SSL certificate must be checked.
133
+ *
134
+ * This value is REQUIRED and cannot be provided via configuration.
135
+ *
136
+ * @example "https://example.com"
137
+ */
138
+ url: string;
139
+ /**
140
+ * Expected SHA-256 fingerprints of the certificate.
141
+ *
142
+ * Resolution order:
143
+ * 1. `options.fingerprints` (runtime)
144
+ * 2. `plugins.TLSFingerprint.fingerprints` (config)
145
+ *
146
+ * If neither is provided, the Promise is rejected with
147
+ * `TLSFingerprintErrorCode.UNAVAILABLE`.
148
+ */
149
+ fingerprints?: string[];
150
+ }
151
+ /**
152
+ * Result returned by an TLS fingerprint operation.
153
+ *
154
+ * This object is returned for ALL outcomes:
155
+ * - Success: `fingerprintMatched: true`
156
+ * - Mismatch: `fingerprintMatched: false` with error info (RESOLVED, not rejected)
157
+ *
158
+ * Only operation failures (invalid input, config missing, network errors,
159
+ * timeout, internal errors) reject the Promise.
160
+ */
161
+ export interface TLSFingerprintResult {
162
+ /**
163
+ * The actual SHA-256 fingerprint of the server certificate.
164
+ *
165
+ * Present in fingerprint and excluded modes.
166
+ */
167
+ actualFingerprint?: string;
168
+ /**
169
+ * Indicates whether the certificate validation succeeded.
170
+ *
171
+ * - true → Pinning passed
172
+ * - false → Pinning failed
173
+ */
174
+ fingerprintMatched: boolean;
175
+ /**
176
+ * The fingerprint that successfully matched, if any.
177
+ */
178
+ matchedFingerprint?: string;
179
+ /**
180
+ * Indicates that TLS fingerprint was skipped because
181
+ * the request host matched an excluded domain.
182
+ */
183
+ excludedDomain?: boolean;
184
+ /**
185
+ * Indicates which pinning mode was used.
186
+ *
187
+ * - "fingerprint"
188
+ * - "excluded"
189
+ */
190
+ mode?: 'fingerprint' | 'excluded';
191
+ /**
192
+ * Human-readable error message when pinning fails.
193
+ * Present when `fingerprintMatched: false`.
194
+ */
195
+ error?: string;
196
+ /**
197
+ * Standardized error code aligned with TLSFingerprintErrorCode.
198
+ */
199
+ errorCode?: TLSFingerprintErrorCode;
200
+ }
201
+ /**
202
+ * Result returned by the getPluginVersion method.
203
+ */
204
+ export interface PluginVersionResult {
205
+ /** The native version string of the plugin. */
206
+ version: string;
207
+ }
208
+ /**
209
+ * TLS Fingerprint Capacitor Plugin interface.
210
+ */
211
+ export interface TLSFingerprintPlugin {
212
+ /**
213
+ * Checks the SSL certificate of a server using a single fingerprint.
214
+ *
215
+ * @throws CapacitorException with code `TLSFingerprintErrorCode`
216
+ *
217
+ * @since 8.0.0
218
+ */
219
+ checkCertificate(options: TLSFingerprintOptions): Promise<TLSFingerprintResult>;
220
+ /**
221
+ * Checks the SSL certificate of a server using multiple allowed fingerprints.
222
+ *
223
+ * @throws CapacitorException with code `TLSFingerprintErrorCode`
224
+ *
225
+ * @since 8.0.0
226
+ */
227
+ checkCertificates(options: TLSFingerprintMultiOptions): Promise<TLSFingerprintResult>;
228
+ /**
229
+ * Returns the native plugin version.
230
+ *
231
+ * The returned version corresponds to the native implementation
232
+ * bundled with the application.
233
+ *
234
+ * @returns A promise resolving to the plugin version.
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const { version } = await TLSFingerprint.getPluginVersion();
239
+ * ```
240
+ *
241
+ * @since 8.0.0
242
+ */
243
+ getPluginVersion(): Promise<PluginVersionResult>;
244
+ }
@@ -0,0 +1,42 @@
1
+ /// <reference types="@capacitor/cli" />
2
+ // -----------------------------------------------------------------------------
3
+ // Enums
4
+ // -----------------------------------------------------------------------------
5
+ /**
6
+ * Standardized error codes for programmatic handling of TLS fingerprint failures.
7
+ *
8
+ * Errors are delivered via Promise rejection as `CapacitorException`
9
+ * with one of the following codes.
10
+ *
11
+ * @since 8.0.0
12
+ */
13
+ export var TLSFingerprintErrorCode;
14
+ (function (TLSFingerprintErrorCode) {
15
+ /** Required data is missing or the feature is not available. */
16
+ TLSFingerprintErrorCode["UNAVAILABLE"] = "UNAVAILABLE";
17
+ /** The user cancelled an interactive flow. */
18
+ TLSFingerprintErrorCode["CANCELLED"] = "CANCELLED";
19
+ /** The user denied a required permission or the feature is disabled. */
20
+ TLSFingerprintErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
21
+ /** The TLS fingerprint operation failed due to a runtime or initialization error. */
22
+ TLSFingerprintErrorCode["INIT_FAILED"] = "INIT_FAILED";
23
+ /** The input provided to the plugin method is invalid, missing, or malformed. */
24
+ TLSFingerprintErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
25
+ /** Invalid or unsupported input was provided. */
26
+ TLSFingerprintErrorCode["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
27
+ /** The requested resource does not exist. */
28
+ TLSFingerprintErrorCode["NOT_FOUND"] = "NOT_FOUND";
29
+ /** The operation conflicts with the current state. */
30
+ TLSFingerprintErrorCode["CONFLICT"] = "CONFLICT";
31
+ /** The operation did not complete within the expected time. */
32
+ TLSFingerprintErrorCode["TIMEOUT"] = "TIMEOUT";
33
+ /** The server certificate fingerprint did not match any expected fingerprint. */
34
+ TLSFingerprintErrorCode["PINNING_FAILED"] = "PINNING_FAILED";
35
+ /** The request host matched an excluded domain. */
36
+ TLSFingerprintErrorCode["EXCLUDED_DOMAIN"] = "EXCLUDED_DOMAIN";
37
+ /** Network connectivity or TLS handshake error. */
38
+ TLSFingerprintErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
39
+ /** SSL/TLS specific error (certificate expired, handshake failure, etc.). */
40
+ TLSFingerprintErrorCode["SSL_ERROR"] = "SSL_ERROR";
41
+ })(TLSFingerprintErrorCode || (TLSFingerprintErrorCode = {}));
42
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAwBxC,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,uBA2BX;AA3BD,WAAY,uBAAuB;IACjC,gEAAgE;IAChE,sDAA2B,CAAA;IAC3B,8CAA8C;IAC9C,kDAAuB,CAAA;IACvB,wEAAwE;IACxE,kEAAuC,CAAA;IACvC,qFAAqF;IACrF,sDAA2B,CAAA;IAC3B,iFAAiF;IACjF,0DAA+B,CAAA;IAC/B,iDAAiD;IACjD,wDAA6B,CAAA;IAC7B,6CAA6C;IAC7C,kDAAuB,CAAA;IACvB,sDAAsD;IACtD,gDAAqB,CAAA;IACrB,+DAA+D;IAC/D,8CAAmB,CAAA;IACnB,iFAAiF;IACjF,4DAAiC,CAAA;IACjC,mDAAmD;IACnD,8DAAmC,CAAA;IACnC,mDAAmD;IACnD,0DAA+B,CAAA;IAC/B,6EAA6E;IAC7E,kDAAuB,CAAA;AACzB,CAAC,EA3BW,uBAAuB,KAAvB,uBAAuB,QA2BlC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @file index.ts
3
+ * Entry point for the TLSFingerprint Capacitor plugin.
4
+ * Registers the plugin and re-exports public API types.
5
+ */
6
+ import { TLSFingerprintPlugin } from './definitions';
7
+ /**
8
+ * The TLSFingerprint plugin instance.
9
+ * It lazily loads the Web implementation when running in a browser.
10
+ */
11
+ declare const TLSFingerprint: TLSFingerprintPlugin;
12
+ export * from './definitions';
13
+ export { TLSFingerprint };
@@ -0,0 +1,11 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ /**
3
+ * The TLSFingerprint plugin instance.
4
+ * It lazily loads the Web implementation when running in a browser.
5
+ */
6
+ const TLSFingerprint = registerPlugin('TLSFingerprint', {
7
+ web: () => import('./web').then((m) => new m.TLSFingerprintWeb()),
8
+ });
9
+ export * from './definitions';
10
+ export { TLSFingerprint };
11
+ //# 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;AAUjD;;;GAGG;AACH,MAAM,cAAc,GAAG,cAAc,CAAuB,gBAAgB,EAAE;IAC5E,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;CAClE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_VERSION = "8.0.0";
@@ -0,0 +1,3 @@
1
+ // This file is automatically generated. Do not modify manually.
2
+ export const PLUGIN_VERSION = '8.0.0';
3
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import { TLSFingerprintPlugin, PluginVersionResult, TLSFingerprintOptions, TLSFingerprintMultiOptions, TLSFingerprintResult } from './definitions';
3
+ /**
4
+ * Web implementation of the TLSFingerprint plugin.
5
+ *
6
+ * This implementation exists to satisfy Capacitor's multi-platform contract.
7
+ * TLS fingerprinting is not supported in web browsers.
8
+ *
9
+ * All methods follow the standard Promise rejection model:
10
+ * - unsupported features reject with UNAVAILABLE
11
+ */
12
+ export declare class TLSFingerprintWeb extends WebPlugin implements TLSFingerprintPlugin {
13
+ constructor();
14
+ /**
15
+ * Checks a single SSL certificate against the expected fingerprint.
16
+ * @param options - Unused on web platform.
17
+ * @throws CapacitorException indicating unimplemented functionality.
18
+ */
19
+ checkCertificate(options: TLSFingerprintOptions): Promise<TLSFingerprintResult>;
20
+ /**
21
+ * Checks multiple SSL certificates against their expected fingerprints.
22
+ * @param options - Unused on web platform.
23
+ * @throws CapacitorException indicating unimplemented functionality.
24
+ */
25
+ checkCertificates(options: TLSFingerprintMultiOptions): Promise<TLSFingerprintResult>;
26
+ /**
27
+ * Returns the plugin version.
28
+ *
29
+ * On the Web, this value represents the JavaScript package version
30
+ * rather than a native implementation.
31
+ */
32
+ getPluginVersion(): Promise<PluginVersionResult>;
33
+ }
@@ -0,0 +1,47 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import { PLUGIN_VERSION } from './version';
3
+ /**
4
+ * Web implementation of the TLSFingerprint plugin.
5
+ *
6
+ * This implementation exists to satisfy Capacitor's multi-platform contract.
7
+ * TLS fingerprinting is not supported in web browsers.
8
+ *
9
+ * All methods follow the standard Promise rejection model:
10
+ * - unsupported features reject with UNAVAILABLE
11
+ */
12
+ export class TLSFingerprintWeb extends WebPlugin {
13
+ constructor() {
14
+ super();
15
+ }
16
+ /**
17
+ * Checks a single SSL certificate against the expected fingerprint.
18
+ * @param options - Unused on web platform.
19
+ * @throws CapacitorException indicating unimplemented functionality.
20
+ */
21
+ async checkCertificate(options) {
22
+ void options;
23
+ throw this.unimplemented();
24
+ }
25
+ /**
26
+ * Checks multiple SSL certificates against their expected fingerprints.
27
+ * @param options - Unused on web platform.
28
+ * @throws CapacitorException indicating unimplemented functionality.
29
+ */
30
+ async checkCertificates(options) {
31
+ void options;
32
+ throw this.unimplemented();
33
+ }
34
+ // -----------------------------------------------------------------------------
35
+ // Plugin Info
36
+ // -----------------------------------------------------------------------------
37
+ /**
38
+ * Returns the plugin version.
39
+ *
40
+ * On the Web, this value represents the JavaScript package version
41
+ * rather than a native implementation.
42
+ */
43
+ async getPluginVersion() {
44
+ return { version: PLUGIN_VERSION };
45
+ }
46
+ }
47
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC9C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAA8B;QACnD,KAAK,OAAO,CAAC;QACb,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAmC;QACzD,KAAK,OAAO,CAAC;QACb,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC7B,CAAC;IAED,gFAAgF;IAChF,cAAc;IACd,gFAAgF;IAEhF;;;;;OAKG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ /// <reference types="@capacitor/cli" />
6
+ // -----------------------------------------------------------------------------
7
+ // Enums
8
+ // -----------------------------------------------------------------------------
9
+ /**
10
+ * Standardized error codes for programmatic handling of TLS fingerprint failures.
11
+ *
12
+ * Errors are delivered via Promise rejection as `CapacitorException`
13
+ * with one of the following codes.
14
+ *
15
+ * @since 8.0.0
16
+ */
17
+ exports.TLSFingerprintErrorCode = void 0;
18
+ (function (TLSFingerprintErrorCode) {
19
+ /** Required data is missing or the feature is not available. */
20
+ TLSFingerprintErrorCode["UNAVAILABLE"] = "UNAVAILABLE";
21
+ /** The user cancelled an interactive flow. */
22
+ TLSFingerprintErrorCode["CANCELLED"] = "CANCELLED";
23
+ /** The user denied a required permission or the feature is disabled. */
24
+ TLSFingerprintErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
25
+ /** The TLS fingerprint operation failed due to a runtime or initialization error. */
26
+ TLSFingerprintErrorCode["INIT_FAILED"] = "INIT_FAILED";
27
+ /** The input provided to the plugin method is invalid, missing, or malformed. */
28
+ TLSFingerprintErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
29
+ /** Invalid or unsupported input was provided. */
30
+ TLSFingerprintErrorCode["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
31
+ /** The requested resource does not exist. */
32
+ TLSFingerprintErrorCode["NOT_FOUND"] = "NOT_FOUND";
33
+ /** The operation conflicts with the current state. */
34
+ TLSFingerprintErrorCode["CONFLICT"] = "CONFLICT";
35
+ /** The operation did not complete within the expected time. */
36
+ TLSFingerprintErrorCode["TIMEOUT"] = "TIMEOUT";
37
+ /** The server certificate fingerprint did not match any expected fingerprint. */
38
+ TLSFingerprintErrorCode["PINNING_FAILED"] = "PINNING_FAILED";
39
+ /** The request host matched an excluded domain. */
40
+ TLSFingerprintErrorCode["EXCLUDED_DOMAIN"] = "EXCLUDED_DOMAIN";
41
+ /** Network connectivity or TLS handshake error. */
42
+ TLSFingerprintErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
43
+ /** SSL/TLS specific error (certificate expired, handshake failure, etc.). */
44
+ TLSFingerprintErrorCode["SSL_ERROR"] = "SSL_ERROR";
45
+ })(exports.TLSFingerprintErrorCode || (exports.TLSFingerprintErrorCode = {}));
46
+
47
+ /**
48
+ * The TLSFingerprint plugin instance.
49
+ * It lazily loads the Web implementation when running in a browser.
50
+ */
51
+ const TLSFingerprint = core.registerPlugin('TLSFingerprint', {
52
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.TLSFingerprintWeb()),
53
+ });
54
+
55
+ // This file is automatically generated. Do not modify manually.
56
+ const PLUGIN_VERSION = '8.0.0';
57
+
58
+ /**
59
+ * Web implementation of the TLSFingerprint plugin.
60
+ *
61
+ * This implementation exists to satisfy Capacitor's multi-platform contract.
62
+ * TLS fingerprinting is not supported in web browsers.
63
+ *
64
+ * All methods follow the standard Promise rejection model:
65
+ * - unsupported features reject with UNAVAILABLE
66
+ */
67
+ class TLSFingerprintWeb extends core.WebPlugin {
68
+ constructor() {
69
+ super();
70
+ }
71
+ /**
72
+ * Checks a single SSL certificate against the expected fingerprint.
73
+ * @param options - Unused on web platform.
74
+ * @throws CapacitorException indicating unimplemented functionality.
75
+ */
76
+ async checkCertificate(options) {
77
+ throw this.unimplemented();
78
+ }
79
+ /**
80
+ * Checks multiple SSL certificates against their expected fingerprints.
81
+ * @param options - Unused on web platform.
82
+ * @throws CapacitorException indicating unimplemented functionality.
83
+ */
84
+ async checkCertificates(options) {
85
+ throw this.unimplemented();
86
+ }
87
+ // -----------------------------------------------------------------------------
88
+ // Plugin Info
89
+ // -----------------------------------------------------------------------------
90
+ /**
91
+ * Returns the plugin version.
92
+ *
93
+ * On the Web, this value represents the JavaScript package version
94
+ * rather than a native implementation.
95
+ */
96
+ async getPluginVersion() {
97
+ return { version: PLUGIN_VERSION };
98
+ }
99
+ }
100
+
101
+ var web = /*#__PURE__*/Object.freeze({
102
+ __proto__: null,
103
+ TLSFingerprintWeb: TLSFingerprintWeb
104
+ });
105
+
106
+ exports.TLSFingerprint = TLSFingerprint;
107
+ //# sourceMappingURL=plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs","sources":["esm/definitions.js","esm/index.js","esm/version.js","esm/web.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n// -----------------------------------------------------------------------------\n// Enums\n// -----------------------------------------------------------------------------\n/**\n * Standardized error codes for programmatic handling of TLS fingerprint failures.\n *\n * Errors are delivered via Promise rejection as `CapacitorException`\n * with one of the following codes.\n *\n * @since 8.0.0\n */\nexport var TLSFingerprintErrorCode;\n(function (TLSFingerprintErrorCode) {\n /** Required data is missing or the feature is not available. */\n TLSFingerprintErrorCode[\"UNAVAILABLE\"] = \"UNAVAILABLE\";\n /** The user cancelled an interactive flow. */\n TLSFingerprintErrorCode[\"CANCELLED\"] = \"CANCELLED\";\n /** The user denied a required permission or the feature is disabled. */\n TLSFingerprintErrorCode[\"PERMISSION_DENIED\"] = \"PERMISSION_DENIED\";\n /** The TLS fingerprint operation failed due to a runtime or initialization error. */\n TLSFingerprintErrorCode[\"INIT_FAILED\"] = \"INIT_FAILED\";\n /** The input provided to the plugin method is invalid, missing, or malformed. */\n TLSFingerprintErrorCode[\"INVALID_INPUT\"] = \"INVALID_INPUT\";\n /** Invalid or unsupported input was provided. */\n TLSFingerprintErrorCode[\"UNKNOWN_TYPE\"] = \"UNKNOWN_TYPE\";\n /** The requested resource does not exist. */\n TLSFingerprintErrorCode[\"NOT_FOUND\"] = \"NOT_FOUND\";\n /** The operation conflicts with the current state. */\n TLSFingerprintErrorCode[\"CONFLICT\"] = \"CONFLICT\";\n /** The operation did not complete within the expected time. */\n TLSFingerprintErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n /** The server certificate fingerprint did not match any expected fingerprint. */\n TLSFingerprintErrorCode[\"PINNING_FAILED\"] = \"PINNING_FAILED\";\n /** The request host matched an excluded domain. */\n TLSFingerprintErrorCode[\"EXCLUDED_DOMAIN\"] = \"EXCLUDED_DOMAIN\";\n /** Network connectivity or TLS handshake error. */\n TLSFingerprintErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n /** SSL/TLS specific error (certificate expired, handshake failure, etc.). */\n TLSFingerprintErrorCode[\"SSL_ERROR\"] = \"SSL_ERROR\";\n})(TLSFingerprintErrorCode || (TLSFingerprintErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\n/**\n * The TLSFingerprint plugin instance.\n * It lazily loads the Web implementation when running in a browser.\n */\nconst TLSFingerprint = registerPlugin('TLSFingerprint', {\n web: () => import('./web').then((m) => new m.TLSFingerprintWeb()),\n});\nexport * from './definitions';\nexport { TLSFingerprint };\n//# sourceMappingURL=index.js.map","// This file is automatically generated. Do not modify manually.\nexport const PLUGIN_VERSION = '8.0.0';\n//# sourceMappingURL=version.js.map","import { WebPlugin } from '@capacitor/core';\nimport { PLUGIN_VERSION } from './version';\n/**\n * Web implementation of the TLSFingerprint plugin.\n *\n * This implementation exists to satisfy Capacitor's multi-platform contract.\n * TLS fingerprinting is not supported in web browsers.\n *\n * All methods follow the standard Promise rejection model:\n * - unsupported features reject with UNAVAILABLE\n */\nexport class TLSFingerprintWeb extends WebPlugin {\n constructor() {\n super();\n }\n /**\n * Checks a single SSL certificate against the expected fingerprint.\n * @param options - Unused on web platform.\n * @throws CapacitorException indicating unimplemented functionality.\n */\n async checkCertificate(options) {\n void options;\n throw this.unimplemented();\n }\n /**\n * Checks multiple SSL certificates against their expected fingerprints.\n * @param options - Unused on web platform.\n * @throws CapacitorException indicating unimplemented functionality.\n */\n async checkCertificates(options) {\n void options;\n throw this.unimplemented();\n }\n // -----------------------------------------------------------------------------\n // Plugin Info\n // -----------------------------------------------------------------------------\n /**\n * Returns the plugin version.\n *\n * On the Web, this value represents the JavaScript package version\n * rather than a native implementation.\n */\n async getPluginVersion() {\n return { version: PLUGIN_VERSION };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["TLSFingerprintErrorCode","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,uBAAuB,EAAE;AACpC;AACA,IAAI,uBAAuB,CAAC,aAAa,CAAC,GAAG,aAAa;AAC1D;AACA,IAAI,uBAAuB,CAAC,WAAW,CAAC,GAAG,WAAW;AACtD;AACA,IAAI,uBAAuB,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AACtE;AACA,IAAI,uBAAuB,CAAC,aAAa,CAAC,GAAG,aAAa;AAC1D;AACA,IAAI,uBAAuB,CAAC,eAAe,CAAC,GAAG,eAAe;AAC9D;AACA,IAAI,uBAAuB,CAAC,cAAc,CAAC,GAAG,cAAc;AAC5D;AACA,IAAI,uBAAuB,CAAC,WAAW,CAAC,GAAG,WAAW;AACtD;AACA,IAAI,uBAAuB,CAAC,UAAU,CAAC,GAAG,UAAU;AACpD;AACA,IAAI,uBAAuB,CAAC,SAAS,CAAC,GAAG,SAAS;AAClD;AACA,IAAI,uBAAuB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;AAChE;AACA,IAAI,uBAAuB,CAAC,iBAAiB,CAAC,GAAG,iBAAiB;AAClE;AACA,IAAI,uBAAuB,CAAC,eAAe,CAAC,GAAG,eAAe;AAC9D;AACA,IAAI,uBAAuB,CAAC,WAAW,CAAC,GAAG,WAAW;AACtD,CAAC,EAAEA,+BAAuB,KAAKA,+BAAuB,GAAG,EAAE,CAAC,CAAC;;ACvC7D;AACA;AACA;AACA;AACK,MAAC,cAAc,GAAGC,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC;;ACPD;AACO,MAAM,cAAc,GAAG,OAAO;;ACCrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE;AACf,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;AAEpC,QAAQ,MAAM,IAAI,CAAC,aAAa,EAAE;AAClC,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,iBAAiB,CAAC,OAAO,EAAE;AAErC,QAAQ,MAAM,IAAI,CAAC,aAAa,EAAE;AAClC,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE;AAC1C,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,110 @@
1
+ var capacitorTLSFingerprint = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ /// <reference types="@capacitor/cli" />
5
+ // -----------------------------------------------------------------------------
6
+ // Enums
7
+ // -----------------------------------------------------------------------------
8
+ /**
9
+ * Standardized error codes for programmatic handling of TLS fingerprint failures.
10
+ *
11
+ * Errors are delivered via Promise rejection as `CapacitorException`
12
+ * with one of the following codes.
13
+ *
14
+ * @since 8.0.0
15
+ */
16
+ exports.TLSFingerprintErrorCode = void 0;
17
+ (function (TLSFingerprintErrorCode) {
18
+ /** Required data is missing or the feature is not available. */
19
+ TLSFingerprintErrorCode["UNAVAILABLE"] = "UNAVAILABLE";
20
+ /** The user cancelled an interactive flow. */
21
+ TLSFingerprintErrorCode["CANCELLED"] = "CANCELLED";
22
+ /** The user denied a required permission or the feature is disabled. */
23
+ TLSFingerprintErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
24
+ /** The TLS fingerprint operation failed due to a runtime or initialization error. */
25
+ TLSFingerprintErrorCode["INIT_FAILED"] = "INIT_FAILED";
26
+ /** The input provided to the plugin method is invalid, missing, or malformed. */
27
+ TLSFingerprintErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
28
+ /** Invalid or unsupported input was provided. */
29
+ TLSFingerprintErrorCode["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
30
+ /** The requested resource does not exist. */
31
+ TLSFingerprintErrorCode["NOT_FOUND"] = "NOT_FOUND";
32
+ /** The operation conflicts with the current state. */
33
+ TLSFingerprintErrorCode["CONFLICT"] = "CONFLICT";
34
+ /** The operation did not complete within the expected time. */
35
+ TLSFingerprintErrorCode["TIMEOUT"] = "TIMEOUT";
36
+ /** The server certificate fingerprint did not match any expected fingerprint. */
37
+ TLSFingerprintErrorCode["PINNING_FAILED"] = "PINNING_FAILED";
38
+ /** The request host matched an excluded domain. */
39
+ TLSFingerprintErrorCode["EXCLUDED_DOMAIN"] = "EXCLUDED_DOMAIN";
40
+ /** Network connectivity or TLS handshake error. */
41
+ TLSFingerprintErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
42
+ /** SSL/TLS specific error (certificate expired, handshake failure, etc.). */
43
+ TLSFingerprintErrorCode["SSL_ERROR"] = "SSL_ERROR";
44
+ })(exports.TLSFingerprintErrorCode || (exports.TLSFingerprintErrorCode = {}));
45
+
46
+ /**
47
+ * The TLSFingerprint plugin instance.
48
+ * It lazily loads the Web implementation when running in a browser.
49
+ */
50
+ const TLSFingerprint = core.registerPlugin('TLSFingerprint', {
51
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.TLSFingerprintWeb()),
52
+ });
53
+
54
+ // This file is automatically generated. Do not modify manually.
55
+ const PLUGIN_VERSION = '8.0.0';
56
+
57
+ /**
58
+ * Web implementation of the TLSFingerprint plugin.
59
+ *
60
+ * This implementation exists to satisfy Capacitor's multi-platform contract.
61
+ * TLS fingerprinting is not supported in web browsers.
62
+ *
63
+ * All methods follow the standard Promise rejection model:
64
+ * - unsupported features reject with UNAVAILABLE
65
+ */
66
+ class TLSFingerprintWeb extends core.WebPlugin {
67
+ constructor() {
68
+ super();
69
+ }
70
+ /**
71
+ * Checks a single SSL certificate against the expected fingerprint.
72
+ * @param options - Unused on web platform.
73
+ * @throws CapacitorException indicating unimplemented functionality.
74
+ */
75
+ async checkCertificate(options) {
76
+ throw this.unimplemented();
77
+ }
78
+ /**
79
+ * Checks multiple SSL certificates against their expected fingerprints.
80
+ * @param options - Unused on web platform.
81
+ * @throws CapacitorException indicating unimplemented functionality.
82
+ */
83
+ async checkCertificates(options) {
84
+ throw this.unimplemented();
85
+ }
86
+ // -----------------------------------------------------------------------------
87
+ // Plugin Info
88
+ // -----------------------------------------------------------------------------
89
+ /**
90
+ * Returns the plugin version.
91
+ *
92
+ * On the Web, this value represents the JavaScript package version
93
+ * rather than a native implementation.
94
+ */
95
+ async getPluginVersion() {
96
+ return { version: PLUGIN_VERSION };
97
+ }
98
+ }
99
+
100
+ var web = /*#__PURE__*/Object.freeze({
101
+ __proto__: null,
102
+ TLSFingerprintWeb: TLSFingerprintWeb
103
+ });
104
+
105
+ exports.TLSFingerprint = TLSFingerprint;
106
+
107
+ return exports;
108
+
109
+ })({}, capacitorExports);
110
+ //# sourceMappingURL=plugin.js.map