1.2.7 • Published 12 months ago

rn-security v1.2.7

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

rn-security

made changes in your root level index.js

import React, { useState, useEffect } from 'react';
import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import SecurityManager from 'rn-security';
import App from './App';
import BlockedApp from './BlockedApp';

const RootComponent = () => {
    const [securityStatus, setSecurityStatus] = useState(null);

    useEffect(() => {
        const checkSecurity = async () => {
            try {
                const securityResult = await SecurityManager.performInitialCheck();
                console.log(securityResult)
                setSecurityStatus(securityResult);
            } catch (error) {
                console.error('Security check error:', error);
                setSecurityStatus('error');
            }
        };

        checkSecurity();
    }, []);

    if (securityStatus?.status === 'active') {
        return <App />;
    } else if (securityStatus?.status === 'deactivate') {
        return <BlockedApp />;
    } else {
        // Optionally return a loading screen while checking security
        return <App />;
    }
};

AppRegistry.registerComponent(appName, () => RootComponent);

add these in index.js

import SecurityManager from 'rn-security';

make on screen also in rootlevel:

import { View, Text } from 'react-native'
import React from 'react'

const BlockedApp = ({ data = null }) => {
  return (
    <View>
      <Text>{data?.message}</Text>
    </View>
  )
}

export default BlockedApp

Note you can pass api key and url from .env

.env

API_URL12 = https://test.in/check/ <--- not yet used, i will update if need to change api
APP_KEY12 = VDDSF###2343

api response:

{"appName": "SjTestApp", "id": 16, "message": "This app is temporarily down, contact with us.", "status": "deactivate"}

if you wan to test obfuscation put this in index.ts , and runing using command of typescript:

code:

import { obscureData, deobscureData } from './obfuscationUtils';

// Test values
const originalUrl = 'https://rimeso.in/appchecks/';
const obscure = obscureData(originalUrl);
const deobscure = deobscureData(obscure);

console.log('Original URL:', originalUrl);
console.log('Obscured URL:', obscure);
console.log('Deobscured URL:', deobscure);

for api request debugging you can use like this in index.ts:

import SecurityManager from './securityManager';

SecurityManager.performInitialCheck().then(((data)=>{
    console.log(data)
})).catch((err)=>{
    console.error(err);
})

run code:

 ts-node src/index.ts

you will get :

Original URL: https://rimeso.in/appchecks/
Obscured URL: MTshIixobmE2JiA6OCp3NiZqMzUpLD03PDkyYR0AGA0UFxgRDAofGgoOGQYAGgQcAQ==
Deobscured URL: https://rimeso.in/appchecks/
1.2.7

12 months ago

1.2.6

12 months ago

1.2.5

12 months ago

1.2.4

12 months ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago