react-native-otp-auto-verify 0.1.8 → 0.2.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.
@@ -100,18 +100,25 @@ class OtpAutoVerifyModule(reactContext: ReactApplicationContext) :
100
100
  }
101
101
 
102
102
  private fun unregisterReceiver() {
103
+ if (!isReceiverRegistered || smsReceiver == null) {
104
+ isListening = false
105
+ return
106
+ }
103
107
  val activity = currentActivity
104
- if (isReceiverRegistered && activity != null && smsReceiver != null) {
105
- try {
108
+ try {
109
+ if (activity != null) {
106
110
  activity.unregisterReceiver(smsReceiver)
107
111
  Log.d(TAG, "SMS receiver unregistered")
108
- } catch (e: Exception) {
109
- Log.e(TAG, "Failed to unregister SMS receiver", e)
110
112
  }
113
+ } catch (e: IllegalArgumentException) {
114
+ Log.w(TAG, "Receiver already unregistered", e)
115
+ } catch (e: Exception) {
116
+ Log.e(TAG, "Failed to unregister SMS receiver", e)
117
+ } finally {
111
118
  isReceiverRegistered = false
112
119
  smsReceiver = null
120
+ isListening = false
113
121
  }
114
- isListening = false
115
122
  }
116
123
 
117
124
  override fun addListener(eventName: String) {
@@ -1,6 +1,6 @@
1
- import { TurboModuleRegistry, type TurboModule } from 'react-native';
1
+ import { NativeModules, TurboModuleRegistry, type TurboModule } from 'react-native';
2
2
 
3
- export interface Spec extends TurboModule {
3
+ export interface OtpAutoVerifySpec extends TurboModule {
4
4
  getConstants(): { OTP_RECEIVED_EVENT: string };
5
5
  getHash(): Promise<ReadonlyArray<string>>;
6
6
  startSmsRetriever(): Promise<boolean>;
@@ -8,4 +8,18 @@ export interface Spec extends TurboModule {
8
8
  removeListeners(count: number): void;
9
9
  }
10
10
 
11
- export default TurboModuleRegistry.getEnforcing<Spec>('OtpAutoVerify');
11
+ function getNativeModule(): OtpAutoVerifySpec {
12
+ try {
13
+ return TurboModuleRegistry.getEnforcing<OtpAutoVerifySpec>('OtpAutoVerify');
14
+ } catch {
15
+ const legacy = NativeModules.OtpAutoVerify;
16
+ if (!legacy) {
17
+ throw new Error(
18
+ 'OtpAutoVerify native module is not available. Ensure the library is properly linked.'
19
+ );
20
+ }
21
+ return legacy as OtpAutoVerifySpec;
22
+ }
23
+ }
24
+
25
+ export default getNativeModule();
@@ -1,26 +1,29 @@
1
1
  "use strict";
2
2
 
3
3
  import * as React from 'react';
4
- import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
4
+ import { NativeEventEmitter, Platform } from 'react-native';
5
5
  import NativeOtpAutoVerify from './NativeOtpAutoVerify';
6
- const {
7
- OtpAutoVerify
8
- } = NativeModules;
9
- const eventEmitter = Platform.OS === 'android' && OtpAutoVerify ? new NativeEventEmitter(OtpAutoVerify) : null;
6
+ const eventEmitter = Platform.OS === 'android' && NativeOtpAutoVerify ? new NativeEventEmitter(NativeOtpAutoVerify) : null;
10
7
  const OTP_RECEIVED_EVENT = NativeOtpAutoVerify.getConstants?.()?.OTP_RECEIVED_EVENT ?? 'otpReceived';
11
- const TIMEOUT_MESSAGE = 'Timeout Error.';
8
+ export const TIMEOUT_MESSAGE = 'Timeout Error.';
12
9
  const DEFAULT_DIGITS = 6;
13
- const OTP_REGEX = {
14
- 4: /\b(\d{4})\b/,
15
- 5: /\b(\d{5})\b/,
16
- 6: /\b(\d{6})\b/
17
- };
18
- /** Extracts a numeric OTP of 4–6 digits from SMS text. */
10
+ const MIN_OTP_DIGITS = 4;
11
+ const MAX_OTP_DIGITS = 8;
12
+ function getOtpRegex(digits) {
13
+ if (digits < MIN_OTP_DIGITS || digits > MAX_OTP_DIGITS) {
14
+ return new RegExp(`\\b(\\d{${DEFAULT_DIGITS}})\\b`);
15
+ }
16
+ return new RegExp(`\\b(\\d{${digits}})\\b`);
17
+ }
18
+ /**
19
+ * Extracts a numeric OTP of 4–8 digits from SMS text.
20
+ */
19
21
  export function extractOtp(sms, numberOfDigits = DEFAULT_DIGITS) {
20
22
  if (!sms || typeof sms !== 'string') return null;
21
23
  const trimmed = sms.trim();
22
24
  if (!trimmed) return null;
23
- const match = trimmed.match(OTP_REGEX[numberOfDigits]);
25
+ const regex = getOtpRegex(numberOfDigits);
26
+ const match = trimmed.match(regex);
24
27
  return match ? match[1] : null;
25
28
  }
26
29
 
@@ -31,10 +34,15 @@ export async function getHash() {
31
34
  return Array.from(arr);
32
35
  }
33
36
 
34
- /** Starts SMS Retriever and subscribes to OTP events. Returns subscription with remove(). */
37
+ /** No-op subscription for platforms where SMS Retriever is not supported (e.g. iOS). */
38
+ const NOOP_SUBSCRIPTION = {
39
+ remove: () => {}
40
+ };
41
+
42
+ /** Starts SMS Retriever and subscribes to OTP events. Returns subscription with remove(). On iOS, returns no-op (call remove() safely). */
35
43
  export async function activateOtpListener(handler, options) {
36
44
  if (Platform.OS !== 'android' || !eventEmitter) {
37
- throw new Error('SMS Retriever is only supported on Android.');
45
+ return NOOP_SUBSCRIPTION;
38
46
  }
39
47
  const numberOfDigits = options?.numberOfDigits ?? DEFAULT_DIGITS;
40
48
  const subscription = eventEmitter.addListener(OTP_RECEIVED_EVENT, (...args) => {
@@ -50,7 +58,10 @@ export async function activateOtpListener(handler, options) {
50
58
  };
51
59
  }
52
60
 
53
- /** Stops SMS listening and removes all listeners. */
61
+ /**
62
+ * Stops SMS listening and removes all listeners.
63
+ * The native module ignores the count parameter and always unregisters the SMS receiver.
64
+ */
54
65
  export function removeListener() {
55
66
  if (Platform.OS === 'android') {
56
67
  NativeOtpAutoVerify.removeListeners(0);
@@ -66,24 +77,30 @@ export function useOtpVerification(options = {}) {
66
77
  const [timeoutError, setTimeoutError] = React.useState(false);
67
78
  const [error, setError] = React.useState(null);
68
79
  const subscriptionRef = React.useRef(null);
80
+ const isStartingRef = React.useRef(false);
69
81
  const stopListening = React.useCallback(() => {
70
82
  subscriptionRef.current?.remove();
71
83
  subscriptionRef.current = null;
84
+ isStartingRef.current = false;
72
85
  removeListener();
73
86
  }, []);
74
87
  const startListening = React.useCallback(async () => {
75
88
  if (Platform.OS !== 'android') return;
89
+ if (isStartingRef.current) return;
90
+ isStartingRef.current = true;
91
+ subscriptionRef.current?.remove();
92
+ subscriptionRef.current = null;
76
93
  setOtp(null);
77
94
  setSms(null);
78
95
  setTimeoutError(false);
79
96
  setError(null);
80
97
  try {
81
- const hashes = await getHash();
82
- setHashCode(hashes[0] ?? '');
83
- } catch (err) {
84
- setError(err instanceof Error ? err : new Error(String(err)));
85
- }
86
- try {
98
+ try {
99
+ const hashes = await getHash();
100
+ setHashCode(hashes[0] ?? '');
101
+ } catch (err) {
102
+ setError(err instanceof Error ? err : new Error(String(err)));
103
+ }
87
104
  const sub = await activateOtpListener((smsText, extractedOtp) => {
88
105
  setSms(smsText);
89
106
  if (smsText === TIMEOUT_MESSAGE) {
@@ -102,6 +119,8 @@ export function useOtpVerification(options = {}) {
102
119
  });
103
120
  setError(wrapped);
104
121
  throw wrapped;
122
+ } finally {
123
+ isStartingRef.current = false;
105
124
  }
106
125
  }, [numberOfDigits]);
107
126
  React.useEffect(() => () => stopListening(), [stopListening]);
@@ -1 +1 @@
1
- {"version":3,"names":["React","NativeEventEmitter","NativeModules","Platform","NativeOtpAutoVerify","OtpAutoVerify","eventEmitter","OS","OTP_RECEIVED_EVENT","getConstants","TIMEOUT_MESSAGE","DEFAULT_DIGITS","OTP_REGEX","extractOtp","sms","numberOfDigits","trimmed","trim","match","getHash","arr","Array","from","activateOtpListener","handler","options","Error","subscription","addListener","args","smsText","String","startSmsRetriever","remove","removeListeners","removeListener","useOtpVerification","hashCode","setHashCode","useState","otp","setOtp","setSms","timeoutError","setTimeoutError","error","setError","subscriptionRef","useRef","stopListening","useCallback","current","startListening","hashes","err","sub","extractedOtp","wrapped","cause","useEffect","useMemo"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAC1E,OAAOC,mBAAmB,MAAM,uBAAuB;AAEvD,MAAM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G,EAAE;MACZP,eAAe,CAACI,OAAO,GAAG,IAAI;MAC9B,MAAMM,OAAO,GAAG,IAAI/B,KAAK,CAAC,8BAA8B,EAAE;QAAEgC,KAAK,EAAEJ;MAAI,CAAC,CAAC;MACzER,QAAQ,CAACW,OAAO,CAAC;MACjB,MAAMA,OAAO;IACf;EACF,CAAC,EAAE,CAAC1C,cAAc,CAAC,CAAC;EAEpBf,KAAK,CAAC2D,SAAS,CAAC,MAAM,MAAMV,aAAa,CAAC,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC;EAE7D,OAAOjD,KAAK,CAAC4D,OAAO,CAClB,OAAO;IACLvB,QAAQ;IACRG,GAAG;IACH1B,GAAG;IACH6B,YAAY;IACZE,KAAK;IACLO,cAAc;IACdH;EACF,CAAC,CAAC,EACF,CAACZ,QAAQ,EAAEG,GAAG,EAAE1B,GAAG,EAAE6B,YAAY,EAAEE,KAAK,EAAEO,cAAc,EAAEH,aAAa,CACzE,CAAC;AACH;AAEA,SAASzC,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["React","NativeEventEmitter","Platform","NativeOtpAutoVerify","eventEmitter","OS","OTP_RECEIVED_EVENT","getConstants","TIMEOUT_MESSAGE","DEFAULT_DIGITS","MIN_OTP_DIGITS","MAX_OTP_DIGITS","getOtpRegex","digits","RegExp","extractOtp","sms","numberOfDigits","trimmed","trim","regex","match","getHash","arr","Array","from","NOOP_SUBSCRIPTION","remove","activateOtpListener","handler","options","subscription","addListener","args","smsText","String","startSmsRetriever","removeListeners","removeListener","useOtpVerification","hashCode","setHashCode","useState","otp","setOtp","setSms","timeoutError","setTimeoutError","error","setError","subscriptionRef","useRef","isStartingRef","stopListening","useCallback","current","startListening","hashes","err","Error","sub","extractedOtp","wrapped","cause","useEffect","useMemo"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AA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EAAEH,aAAa,CACzE,CAAC;AACH;AAEA,SAAS/C,kBAAkB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { type TurboModule } from 'react-native';
2
- export interface Spec extends TurboModule {
2
+ export interface OtpAutoVerifySpec extends TurboModule {
3
3
  getConstants(): {
4
4
  OTP_RECEIVED_EVENT: string;
5
5
  };
@@ -8,6 +8,6 @@ export interface Spec extends TurboModule {
8
8
  addListener(eventName: string): void;
9
9
  removeListeners(count: number): void;
10
10
  }
11
- declare const _default: Spec;
11
+ declare const _default: OtpAutoVerifySpec;
12
12
  export default _default;
13
13
  //# sourceMappingURL=NativeOtpAutoVerify.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NativeOtpAutoVerify.d.ts","sourceRoot":"","sources":["../../../src/NativeOtpAutoVerify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,YAAY,IAAI;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;;AAED,wBAAuE"}
1
+ {"version":3,"file":"NativeOtpAutoVerify.d.ts","sourceRoot":"","sources":["../../../src/NativeOtpAutoVerify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpF,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,YAAY,IAAI;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;;AAgBD,wBAAiC"}
@@ -1,7 +1,8 @@
1
1
  declare const OTP_RECEIVED_EVENT: string;
2
- export type OtpDigits = 4 | 5 | 6;
2
+ export declare const TIMEOUT_MESSAGE = "Timeout Error.";
3
+ export type OtpDigits = 4 | 5 | 6 | 7 | 8;
3
4
  export interface UseOtpVerificationOptions {
4
- /** Extract OTP with this many digits (4, 5, or 6). OTP is set when SMS is received. */
5
+ /** Extract OTP with this many digits (4–8). OTP is set when SMS is received. */
5
6
  numberOfDigits?: OtpDigits;
6
7
  }
7
8
  export interface UseOtpVerificationResult {
@@ -23,15 +24,20 @@ export interface UseOtpVerificationResult {
23
24
  export interface OtpListenerSubscription {
24
25
  remove: () => void;
25
26
  }
26
- /** Extracts a numeric OTP of 4–6 digits from SMS text. */
27
+ /**
28
+ * Extracts a numeric OTP of 4–8 digits from SMS text.
29
+ */
27
30
  export declare function extractOtp(sms: string, numberOfDigits?: OtpDigits): string | null;
28
31
  /** Returns app hash strings for the current app. Android only; iOS returns []. */
29
32
  export declare function getHash(): Promise<string[]>;
30
- /** Starts SMS Retriever and subscribes to OTP events. Returns subscription with remove(). */
33
+ /** Starts SMS Retriever and subscribes to OTP events. Returns subscription with remove(). On iOS, returns no-op (call remove() safely). */
31
34
  export declare function activateOtpListener(handler: (sms: string, extractedOtp?: string | null) => void, options?: {
32
35
  numberOfDigits?: OtpDigits;
33
36
  }): Promise<OtpListenerSubscription>;
34
- /** Stops SMS listening and removes all listeners. */
37
+ /**
38
+ * Stops SMS listening and removes all listeners.
39
+ * The native module ignores the count parameter and always unregisters the SMS receiver.
40
+ */
35
41
  export declare function removeListener(): void;
36
42
  /** Hook for OTP verification. Call startListening() to begin; listener is stopped on unmount. */
37
43
  export declare function useOtpVerification(options?: UseOtpVerificationOptions): UseOtpVerificationResult;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,kBAAkB,QAET,CAAC;AAKhB,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAQlC,MAAM,WAAW,yBAAyB;IACxC,uFAAuF;IACvF,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,mCAAmC;IACnC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,6DAA6D;IAC7D,YAAY,EAAE,OAAO,CAAC;IACtB,oHAAoH;IACpH,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,mEAAmE;IACnE,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,oDAAoD;IACpD,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,0DAA0D;AAC1D,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,cAAc,GAAE,SAA0B,GACzC,MAAM,GAAG,IAAI,CAMf;AAED,kFAAkF;AAClF,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAIjD;AAED,6FAA6F;AAC7F,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,EAC5D,OAAO,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,SAAS,CAAA;CAAE,GACvC,OAAO,CAAC,uBAAuB,CAAC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CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,EAC5D,OAAO,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,SAAS,CAAA;CAAE,GACvC,OAAO,CAAC,uBAAuB,CAAC,CAqBlC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAIrC;AAED,iGAAiG;AACjG,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,yBAA8B,GACtC,wBAAwB,CAyE1B;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,183 +1,175 @@
1
- {
2
- "name": "react-native-otp-auto-verify",
3
- "version": "0.1.8",
4
- "description": "react-native-otp-auto-verify is a React Native library for automatic OTP verification on Android and iOS. It uses the Google SMS Retriever API to detect OTP codes automatically without requiring the READ_SMS permission. The library is fully Play Store compliant, improves user login experience, supports TurboModule, and works with the React Native New Architecture",
5
- "keywords": [
6
- "react-native",
7
- "react-native-library",
8
- "react-native-otp",
9
- "react-native-otp-auto-verify",
10
- "react-native-sms",
11
- "otp",
12
- "otp-verification",
13
- "otp-auto-verify",
14
- "otp-auto-read",
15
- "sms",
16
- "sms-retriever",
17
- "google-sms-retriever",
18
- "android-otp",
19
- "ios-otp",
20
- "otp-without-permission",
21
- "play-store-compliant",
22
- "react-native-new-architecture",
23
- "turbo-module"
24
- ],
25
- "homepage": "https://github.com/kailas-rathod/react-native-otp-auto-verify?tab=readme-ov-file",
26
- "bugs": {
27
- "url": "https://github.com/kailas-rathod/react-native-otp-auto-verify/issues"
28
- },
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/kailas-rathod/react-native-otp-auto-verify.git"
32
- },
33
- "license": "MIT",
34
- "author": "Kailas Rathod (https://github.com/kailas-rathod)",
35
- "type": "commonjs",
36
- "main": "./lib/module/index.js",
37
- "types": "./lib/typescript/src/index.d.ts",
38
- "files": [
39
- "src",
40
- "lib",
41
- "android",
42
- "ios",
43
- "cpp",
44
- "*.podspec",
45
- "react-native.config.js",
46
- "!ios/build",
47
- "!android/build",
48
- "!android/gradle",
49
- "!android/gradlew",
50
- "!android/gradlew.bat",
51
- "!android/local.properties",
52
- "!**/__tests__",
53
- "!**/__fixtures__",
54
- "!**/__mocks__",
55
- "!**/.*"
56
- ],
57
- "scripts": {
58
- "prepare": "bob build",
59
- "typecheck": "tsc",
60
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
61
- "test": "jest",
62
- "check": "yarn typecheck && yarn lint && yarn test",
63
- "release": "release-it --only-version"
64
- },
65
- "devDependencies": {
66
- "@commitlint/config-conventional": "^19.8.1",
67
- "@eslint/compat": "^1.3.2",
68
- "@eslint/eslintrc": "^3.3.4",
69
- "@eslint/js": "^9.35.0",
70
- "@react-native/babel-preset": "0.83.0",
71
- "@react-native-community/eslint-config": "^3.2.0",
72
- "@release-it/conventional-changelog": "^10.0.1",
73
- "@types/jest": "^29.5.14",
74
- "@types/react": "^19.2.0",
75
- "commitlint": "^19.8.1",
76
- "eslint": "^10.0.2",
77
- "eslint-config-prettier": "^10.1.8",
78
- "eslint-plugin-prettier": "^5.5.4",
79
- "eslint-plugin-react-native": "^5.0.0",
80
- "jest": "^30.2.0",
81
- "prettier": "^2.8.8",
82
- "react": "19.2.4",
83
- "react-native": "0.83.0",
84
- "react-native-builder-bob": "0.39.1",
85
- "release-it": "^19.0.4",
86
- "typescript": "^5.9.3"
87
- },
88
- "peerDependencies": {
89
- "react": "*",
90
- "react-native": "*"
91
- },
92
- "publishConfig": {
93
- "registry": "https://registry.npmjs.org/"
94
- },
95
- "eslintConfig": {
96
- "root": true,
97
- "extends": [
98
- "@react-native-community",
99
- "prettier"
100
- ],
101
- "rules": {
102
- "prettier/prettier": [
103
- "error",
104
- {
105
- "quoteProps": "consistent",
106
- "singleQuote": true,
107
- "tabWidth": 2,
108
- "trailingComma": "es5",
109
- "useTabs": false
110
- }
111
- ]
112
- }
113
- },
114
- "eslintIgnore": [
115
- "node_modules/",
116
- "lib/"
117
- ],
118
- "packageManager": "yarn@4.11.0",
119
- "react-native-builder-bob": {
120
- "source": "src",
121
- "output": "lib",
122
- "targets": [
123
- [
124
- "module",
125
- {
126
- "esm": true
127
- }
128
- ],
129
- [
130
- "typescript",
131
- {
132
- "project": "tsconfig.build.json"
133
- }
134
- ]
135
- ]
136
- },
137
- "codegenConfig": {
138
- "name": "OtpAutoVerifySpec",
139
- "type": "modules",
140
- "jsSrcsDir": "src",
141
- "android": {
142
- "javaPackageName": "com.otpautoverify"
143
- }
144
- },
145
- "prettier": {
146
- "quoteProps": "consistent",
147
- "singleQuote": true,
148
- "tabWidth": 2,
149
- "trailingComma": "es5",
150
- "useTabs": false
151
- },
152
- "jest": {
153
- "preset": "react-native",
154
- "modulePathIgnorePatterns": [
155
- "<rootDir>/example/node_modules",
156
- "<rootDir>/lib/"
157
- ]
158
- },
159
- "commitlint": {
160
- "extends": [
161
- "@commitlint/config-conventional"
162
- ]
163
- },
164
- "release-it": {
165
- "git": {
166
- "commitMessage": "chore: release ${version}",
167
- "tagName": "v${version}"
168
- },
169
- "npm": {
170
- "publish": true
171
- },
172
- "github": {
173
- "release": true
174
- },
175
- "plugins": {
176
- "@release-it/conventional-changelog": {
177
- "preset": {
178
- "name": "angular"
179
- }
180
- }
181
- }
182
- }
183
- }
1
+ {
2
+ "name": "react-native-otp-auto-verify",
3
+ "version": "0.2.0",
4
+ "description": "react-native-otp-auto-verify is a React Native library for automatic OTP verification on Android and iOS. It uses the Google SMS Retriever API to detect OTP codes automatically without requiring the READ_SMS permission. The library is fully Play Store compliant, improves user login experience, supports TurboModule, and works with the React Native New Architecture",
5
+ "keywords": [
6
+ "react-native",
7
+ "react-native-library",
8
+ "react-native-otp",
9
+ "react-native-otp-auto-verify",
10
+ "react-native-sms",
11
+ "otp",
12
+ "otp-verification",
13
+ "otp-auto-verify",
14
+ "otp-auto-read",
15
+ "sms",
16
+ "sms-retriever",
17
+ "google-sms-retriever",
18
+ "android-otp",
19
+ "ios-otp",
20
+ "otp-without-permission",
21
+ "play-store-compliant",
22
+ "react-native-new-architecture",
23
+ "turbo-module"
24
+ ],
25
+ "homepage": "https://github.com/kailas-rathod/react-native-otp-auto-verify?tab=readme-ov-file",
26
+ "bugs": {
27
+ "url": "https://github.com/kailas-rathod/react-native-otp-auto-verify/issues"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/kailas-rathod/react-native-otp-auto-verify.git"
32
+ },
33
+ "license": "MIT",
34
+ "author": "Kailas Rathod (https://github.com/kailas-rathod)",
35
+ "type": "commonjs",
36
+ "main": "./lib/module/index.js",
37
+ "types": "./lib/typescript/src/index.d.ts",
38
+ "files": [
39
+ "src",
40
+ "lib",
41
+ "android",
42
+ "ios",
43
+ "*.podspec",
44
+ "react-native.config.js",
45
+ "!ios/build",
46
+ "!android/build",
47
+ "!android/gradle",
48
+ "!android/gradlew",
49
+ "!android/gradlew.bat",
50
+ "!android/local.properties",
51
+ "!**/__tests__",
52
+ "!**/__fixtures__",
53
+ "!**/__mocks__",
54
+ "!**/.*"
55
+ ],
56
+ "scripts": {
57
+ "prepare": "bob build",
58
+ "typecheck": "tsc",
59
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
60
+ "test": "jest",
61
+ "check": "yarn typecheck && yarn lint && yarn test",
62
+ "release": "release-it --only-version"
63
+ },
64
+ "devDependencies": {
65
+ "@commitlint/config-conventional": "^19.8.1",
66
+ "@eslint/compat": "^1.3.2",
67
+ "@eslint/eslintrc": "^3.3.4",
68
+ "@eslint/js": "^9.35.0",
69
+ "@react-native/babel-preset": "0.83.0",
70
+ "@react-native-community/eslint-config": "^3.2.0",
71
+ "@release-it/conventional-changelog": "^10.0.1",
72
+ "@types/jest": "^29.5.14",
73
+ "@types/react": "^19.2.0",
74
+ "commitlint": "^19.8.1",
75
+ "eslint": "^10.0.2",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-prettier": "^5.5.4",
78
+ "eslint-plugin-react-native": "^5.0.0",
79
+ "jest": "^30.2.0",
80
+ "prettier": "^2.8.8",
81
+ "react": "19.2.4",
82
+ "react-native": "0.83.0",
83
+ "react-native-builder-bob": "0.39.1",
84
+ "release-it": "^19.0.4",
85
+ "typescript": "^5.9.3"
86
+ },
87
+ "peerDependencies": {
88
+ "react": "*",
89
+ "react-native": "*"
90
+ },
91
+ "publishConfig": {
92
+ "registry": "https://registry.npmjs.org/"
93
+ },
94
+ "eslintConfig": {
95
+ "root": true,
96
+ "extends": [
97
+ "@react-native-community",
98
+ "prettier"
99
+ ],
100
+ "rules": {
101
+ "prettier/prettier": [
102
+ "error",
103
+ {
104
+ "quoteProps": "consistent",
105
+ "singleQuote": true,
106
+ "tabWidth": 2,
107
+ "trailingComma": "es5",
108
+ "useTabs": false
109
+ }
110
+ ]
111
+ }
112
+ },
113
+ "eslintIgnore": [
114
+ "node_modules/",
115
+ "lib/"
116
+ ],
117
+ "packageManager": "yarn@4.11.0",
118
+ "react-native-builder-bob": {
119
+ "source": "src",
120
+ "output": "lib",
121
+ "targets": [
122
+ [
123
+ "module",
124
+ {
125
+ "esm": true
126
+ }
127
+ ],
128
+ [
129
+ "typescript",
130
+ {
131
+ "project": "tsconfig.build.json"
132
+ }
133
+ ]
134
+ ]
135
+ },
136
+ "codegenConfig": {
137
+ "name": "OtpAutoVerifySpec",
138
+ "type": "modules",
139
+ "jsSrcsDir": "src",
140
+ "android": {
141
+ "javaPackageName": "com.otpautoverify"
142
+ }
143
+ },
144
+ "prettier": {
145
+ "quoteProps": "consistent",
146
+ "singleQuote": true,
147
+ "tabWidth": 2,
148
+ "trailingComma": "es5",
149
+ "useTabs": false
150
+ },
151
+ "commitlint": {
152
+ "extends": [
153
+ "@commitlint/config-conventional"
154
+ ]
155
+ },
156
+ "release-it": {
157
+ "git": {
158
+ "commitMessage": "chore: release ${version}",
159
+ "tagName": "v${version}"
160
+ },
161
+ "npm": {
162
+ "publish": true
163
+ },
164
+ "github": {
165
+ "release": true
166
+ },
167
+ "plugins": {
168
+ "@release-it/conventional-changelog": {
169
+ "preset": {
170
+ "name": "angular"
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }