
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
react-native-sms-retriever-with-version-check
Advanced tools
Android SMS Retriever API for React Native.
With the SMS Retriever API, you can perform SMS-based user verification in your Android app automatically, without requiring the user to manually type verification codes, and without requiring any extra app permissions.
npm install --save react-native-sms-retriever
react-native link react-native-sms-retriever
android/settings.gradle
:include ':react-native-sms-retriever'
project(':react-native-sms-retriever').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sms-retriever/android')
android/app/build.gradle
:dependencies {
// ...
compile project(':react-native-sms-retriever')
}
MainApplication.java
:import me.furtado.smsretriever.RNSmsRetrieverPackage; // <-- Add the import
public class MainApplication extends Application implements ReactApplication {
// ...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
// ...
new RNSmsRetrieverPackage() // <-- Add it to the packages list
);
}
// ...
}
import SmsRetriever from 'react-native-sms-retriever';
// Get the phone number (first gif)
_onPhoneNumberPressed = async () => {
try {
const phoneNumber = await SmsRetriever.requestPhoneNumber();
} catch (error) {
console.log(JSON.stringify(error));
}
};
// Get the SMS message (second gif)
_onSmsListenerPressed = async () => {
try {
const registered = await SmsRetriever.startSmsRetriever();
if (registered) {
SmsRetriever.addSmsListener(event => {
console.log(event.message);
SmsRetriever.removeSmsListener();
});
}
} catch (error) {
console.log(JSON.stringify(error));
}
};
To get the phone number, use a real device. The SMS Retriever API doesn't work very well with emulators.
The SMS Retriever API has some rules for message. A valid verification message might look like the following:
<#> Your Example app code is: 123ABC78
/SBnkJ8069Q
The <#>
is required. The /SBnkJ8069Q
is a hash string that identifies your app (in the case it's the hash of the example app). Too see how to generate the hash access this link. Alternatively, you can get your app's hash string with the AppSignatureHelper class.
requestPhoneNumber(): Promise<String>
Obtain the user's phone number (using the hint picket).
Error Type | Error Message |
---|---|
ACTIVITY_NULL_ERROR_TYPE | Activity is null. |
ACTIVITY_RESULT_NOOK_ERROR_TYPE | There was an error trying to get the phone number. |
CONNECTION_SUSPENENDED_ERROR_TYPE | Client is temporarily in a disconnected state. |
CONNECTION_FAILED_ERROR_TYPE | There was an error connecting the client to the service. |
SEND_INTENT_ERROR_TYPE | There was an error trying to send intent. |
UNAVAILABLE_ERROR_TYPE | Google Play Services is not available. |
UNSUPORTED_VERSION_ERROR_TYPE | The device version of Google Play Services is not supported. |
startSmsRetriever(): Promise<Boolean>
Start to listen for SMS messages.
Error Type | Error Message |
---|---|
TASK_FAILURE_ERROR_TYPE | Task failed. |
UNAVAILABLE_ERROR_TYPE | Google Play Services is not available. |
UNSUPORTED_VERSION_ERROR_TYPE | The device version of Google Play Services is not supported. |
addSmsListener(event: Function): Promise<Boolean>
Get the SMS content. Get the SMS content with: event.message
.
Error Param | Type | Description |
---|---|---|
extras | String | Sent only when there was a problem getting the SMS content. |
status | String | Sent only when status is not OK or TIMEOUT . |
timeout | String | Sent only when status is equals to TIMEOUT . |
removeSmsListener(): Void
Stop to listen for SMS messages.
A brief summary of each React Native SMS Retriever release can be found on the releases.
This code is distributed under the terms and conditions of the MIT License.
FAQs
Android SMS Retriever API for React Native.
The npm package react-native-sms-retriever-with-version-check receives a total of 4 weekly downloads. As such, react-native-sms-retriever-with-version-check popularity was classified as not popular.
We found that react-native-sms-retriever-with-version-check demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.