<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pedro Fortuna</title>
    <description>The latest articles on DEV Community by Pedro Fortuna (@pedrofortuna).</description>
    <link>https://dev.to/pedrofortuna</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F371171%2Fe0ea47b6-4c4f-4b14-98dc-59b15c2acddb.jpeg</url>
      <title>DEV Community: Pedro Fortuna</title>
      <link>https://dev.to/pedrofortuna</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pedrofortuna"/>
    <language>en</language>
    <item>
      <title>How to Protect React Native Apps with Jscrambler</title>
      <dc:creator>Pedro Fortuna</dc:creator>
      <pubDate>Fri, 14 Jun 2019 16:35:24 +0000</pubDate>
      <link>https://dev.to/jscrambler/how-to-protect-react-native-apps-with-jscrambler-1ijo</link>
      <guid>https://dev.to/jscrambler/how-to-protect-react-native-apps-with-jscrambler-1ijo</guid>
      <description>&lt;p&gt;&lt;a href="https://facebook.github.io/react-native/"&gt;React Native&lt;/a&gt; is a React-based open-source mobile application framework developed by Facebook. It is actually one of the most popular JavaScript frameworks for mobile development, as shown by the 2018 "&lt;a href="https://2018.stateofjs.com/mobile-and-desktop/react-native/"&gt;State of JavaScript&lt;/a&gt;" survey.&lt;/p&gt;

&lt;p&gt;By following this tutorial, you will be able to integrate Jscrambler seamlessly into React Native's build process and protect your app with the most potent and resilient &lt;a href="https://jscrambler.com/products/code-integrity/javascript-obfuscation"&gt;obfuscation&lt;/a&gt; techniques, &lt;a href="https://blog.jscrambler.com/jscrambler-101-code-locks/"&gt;code locks&lt;/a&gt;, &lt;a href="https://blog.jscrambler.com/jscrambler-101-self-defending/"&gt;self-defensive&lt;/a&gt;, and &lt;a href="https://docs.jscrambler.com/6.1/code-integrity/documentation/transformations/self-healing"&gt;self-healing&lt;/a&gt; capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-Requisites
&lt;/h2&gt;

&lt;p&gt;To properly integrate Jscrambler into the React Native build process, we only need to &lt;strong&gt;set up a React Native app&lt;/strong&gt; and &lt;strong&gt;configure Jscrambler&lt;/strong&gt;. Let's cover both steps below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a React Native Application
&lt;/h3&gt;

&lt;p&gt;To create a mobile app using React Native, you have &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html"&gt;two main approaches&lt;/a&gt;: using Expo or using the React Native CLI. Usually, Expo is more suited for developers with a Web Development background (it doesn't require Xcode or Android Studio), while using the React Native CLI is most advisable for those that come from a Native Development background (it requires Xcode or Android Studio).&lt;/p&gt;

&lt;p&gt;To integrate Jscrambler into the React Native build process, we'll have to use the React Native CLI. However, if you're using Expo, you can also integrate Jscrambler by ejecting the project, as we'll explore further below.&lt;/p&gt;

&lt;p&gt;For the purposes of this tutorial, we will be cloning a simple Grocery List app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/jscrambler/Integration-Examples.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, let's transverse into the React Native app's directory and install the project's dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd Integration-Examples/ReactNative/Example-Apps/react-native-grocery-list/
npm i
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The simplified base project structure of our &lt;em&gt;React Native&lt;/em&gt; application is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react-native-grocery-list/
|-- app.json
|-- babel.config.js
|-- index.js
|-- metro.config.js
|-- package.json
|-- yarn.lock
|-- __tests__/
|-- .expo/
|-- android/
| |-- app/
| | |-- build/
|-- App/
|-- assets/
|-- ios/
|-- node_modules/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;package.json&lt;/code&gt; contains all the configurations which are related to npm such as dependencies, version and scripts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;App&lt;/code&gt; directory features the source code of the application. The sources are then built and packed into either the &lt;code&gt;android&lt;/code&gt; or &lt;code&gt;ios&lt;/code&gt; directory. This is where our protected HTML and JavaScript files will be placed after the build.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And we have successfully set up our React Native app. Let's move forward to protecting it with Jscrambler.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring Jscrambler
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;If you haven't created a &lt;a href="https://jscrambler.com/signup?utm_source=dev.to&amp;amp;utm_medium=referral&amp;amp;utm_campaign=protect-react"&gt;Jscrambler account&lt;/a&gt; yet, be sure to do so before moving forward.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All of Jscrambler's configuration will reside inside a single file: &lt;code&gt;.jscramblerrc&lt;/code&gt;, which specifies which transformations we wish to use.&lt;/p&gt;

&lt;p&gt;The quickest way to get our config file is via the &lt;a href="https://app.jscrambler.com/dashboard?utm_source=dev.to&amp;amp;utm_medium=referral&amp;amp;utm_campaign=protect-react"&gt;Jscrambler Web App&lt;/a&gt;. Once there, create a new app. Now, in the &lt;em&gt;Application Modes&lt;/em&gt; tab, select the Language Specifications and application type. Next, select the transformations you want (check the &lt;em&gt;Templates&lt;/em&gt; and &lt;em&gt;Fine-Tuning&lt;/em&gt; tabs). In this tutorial, we'll be selecting the &lt;em&gt;Obfuscation&lt;/em&gt; template. If you need help with these steps, please refer to our &lt;a href="https://blog.jscrambler.com/jscrambler-101-how-to-use-the-cli/"&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, we simply have to download a &lt;strong&gt;JSON file with all this configuration&lt;/strong&gt;, which will be used only for quickly getting the required settings.&lt;/p&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rOFCpH6N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.jscrambler.com/content/images/2018/08/jscrambler-101-first-use-download-json.png" alt="Download Jscrambler JSON"&gt;&lt;/center&gt;

&lt;p&gt;Now, let's create a new file named &lt;code&gt;.jscramblerrc&lt;/code&gt; on the React Native project’s root folder. Open the &lt;code&gt;jscrambler.json&lt;/code&gt; file you just downloaded and copy all its contents to the &lt;code&gt;.jscramblerrc&lt;/code&gt; file. Your final &lt;code&gt;.jscramblerrc&lt;/code&gt; file should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"keys"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"accessKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;ACCESS_KEY_HERE&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"secretKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;SECRET_KEY_HERE&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"applicationId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;APP_ID_HERE&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"objectPropertiesSparsing"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"variableMasking"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"whitespaceRemoval"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dotToBracketNotation"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stringConcealing"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"functionReordering"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"propertyKeysObfuscation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="nl"&gt;"encoding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"hexadecimal"&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"regexObfuscation"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="nl"&gt;"features"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"opaqueSteps"&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"controlFlowFlattening"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"booleanToAnything"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"identifiersRenaming"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"areSubscribersOrdered"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"applicationTypes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"webBrowserApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"desktopApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"serverApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"hybridMobileApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"javascriptNativeApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"html5GameApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"languageSpecifications"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"es5"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"es6"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"es7"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"useRecommendedOrder"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Because we got this information directly via the Jscrambler Web App, our &lt;code&gt;accessKey&lt;/code&gt;, &lt;code&gt;secretKey&lt;/code&gt; and &lt;code&gt;applicationId&lt;/code&gt; fields are already filled. If you wish to retrieve them manually, refer to our &lt;a href="https://blog.jscrambler.com/jscrambler-101-first-use/"&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's important to note that the &lt;code&gt;params&lt;/code&gt; section specifies the transformations that will be used to protect your React Native app. &lt;strong&gt;These can be hand-picked by you&lt;/strong&gt;, by selecting them in the Web App or setting them manually. You can find documentation on all the available transformations &lt;a href="https://docs.jscrambler.com/code-integrity/documentation/transformations?utm_source=dev.to&amp;amp;utm_medium=referral&amp;amp;utm_campaign=protect-react"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrating Jscrambler in the Build Process
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In case you have used Expo to set up your React Native project, in order to continue with the Jscrambler integration you must first eject it using &lt;code&gt;expo eject&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since React Native uses its own bundler called Metro, Jscrambler’s React Native integration is achieved through a Metro plugin.&lt;/p&gt;

&lt;p&gt;To get started, install the &lt;a href="https://github.com/jscrambler/jscrambler/tree/master/packages/jscrambler-metro-plugin"&gt;Jscrambler Metro Plugin&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install jscrambler-metro-plugin --save-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next, create a &lt;code&gt;metro.config.js&lt;/code&gt; file on the project's root folder (in our case, we already have that file). Now, we need to place two lines of code at the top of the file. This code imports the Jscrambler Metro plugin and will enable our app to use it. In the case of our Groceries App, we can simply delete all the existing code in the &lt;code&gt;metro.config.js&lt;/code&gt; and paste this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const jscramblerMetroPlugin = require('jscrambler-metro-plugin')();

module.exports = jscramblerMetroPlugin;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And that's it! We're ready to build our application! To do so, there are different approaches for Android and iOS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Android&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To generate an APK file and install it on an attached device or emulator, we use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd android &amp;amp;&amp;amp; ./gradlew installDebug
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To simply generate the APK file without installing it, we run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd android &amp;amp;&amp;amp; ./gradlew assembleDebug
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For iOS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we are building for iOS, the process is a bit trickier. First, we need to bundle our source files and prepare it before creating our IPA package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will output a &lt;code&gt;main.jsbundle&lt;/code&gt; file which we then need to use in Xcode to build our IPA. To do so, you can follow &lt;a href="https://medium.com/@tunvirrahmantusher/create-ipa-and-apk-from-react-native-72fe53c6a8db"&gt;this guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We will find the mobile application package for Android (APK) or iOS (IPA) on &lt;code&gt;&amp;lt;android|ios&amp;gt;/app/build/outputs/&amp;lt;apk|ipa&amp;gt;/debug&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;React Native is often the JS framework of choice for building cross-platform mobile apps in the enterprise. Other than Facebook, it’s also used by companies like Bloomberg, Tesla, Uber, Wix, and Discord.&lt;/p&gt;

&lt;p&gt;Now more than ever, attackers are actively seeking to exploit the exposed nature of JavaScript to steal or tamper with the JavaScript code that often contains critical business logic. This is why protecting your React Native source code with Jscrambler becomes a key step of the development process.&lt;/p&gt;

&lt;p&gt;By using our Metro plugin, you can integrate Jscrambler into the React Native build process in a few minutes. If, however, you encounter any issues during this integration, so be sure to check our &lt;a href="https://docs.jscrambler.com/code-integrity/frameworks-and-libraries/react-native"&gt;documentation&lt;/a&gt; or &lt;a href="//mailto:support@jscrambler.com"&gt;contact us&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>javascript</category>
      <category>security</category>
    </item>
    <item>
      <title>Protecting Your React.js Source Code with Jscrambler</title>
      <dc:creator>Pedro Fortuna</dc:creator>
      <pubDate>Mon, 04 Feb 2019 15:31:24 +0000</pubDate>
      <link>https://dev.to/jscrambler/protecting-your-reactjs-source-code-with-jscrambler-36nn</link>
      <guid>https://dev.to/jscrambler/protecting-your-reactjs-source-code-with-jscrambler-36nn</guid>
      <description>&lt;p&gt;&lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;React.js&lt;/a&gt; is one of the most popular JavaScript libraries. The 2018 "State of JavaScript" survey puts React as the &lt;a href="https://2018.stateofjs.com/front-end-frameworks/overview/" rel="noopener noreferrer"&gt;front-end framework of choice&lt;/a&gt;, with 65% of responders stating that they have used it and would use again.&lt;/p&gt;

&lt;p&gt;With its elegant programming style, rich package ecosystem and good documentation, React has found its way into powering the applications of large enterprises. Specifically, the developer survey found that &lt;strong&gt;18% of responders which are using React work for companies with over 1000 employees&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As we know, the very nature of JavaScript means it can't be encrypted and can easily be accessed on the client-side or even tampered with.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Because React powers enterprise-grade applications, it requires an enterprise-grade security solution such as Jscrambler.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This tutorial will explain how to integrate Jscrambler seamlessly into React's build process in just a few minutes. You'll learn how to protect your React source code with the most advanced polymorphic obfuscation techniques, along with code locks and self-defensive capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-Requisites
&lt;/h2&gt;

&lt;p&gt;Only two things are needed to properly integrate Jscrambler into the React build process: &lt;strong&gt;creating a React app&lt;/strong&gt; and &lt;strong&gt;configuring Jscrambler&lt;/strong&gt;. We will highlight both below.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Create a &lt;em&gt;React&lt;/em&gt; Application
&lt;/h3&gt;

&lt;p&gt;For the purposes of this tutorial, we will be using a &lt;code&gt;create-react-app&lt;/code&gt; boilerplate app. To get started, we will need to install it using npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; create-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will download &lt;code&gt;create-react-app&lt;/code&gt; and install it globally with all the required dependencies for the latest React version.&lt;/p&gt;

&lt;p&gt;Now, we're ready to create our boilerplate app, which we'll use as the basis for this tutorial. Start by creating this new app with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;create-react-app react-jscrambler-boilerplate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the installation finishes, we can run our newly created boilerplate app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;react-jscrambler-boilerplate
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our new React app will run on development mode and appear at &lt;code&gt;localhost:3000&lt;/code&gt;. Check if everything is in place before moving to the next step. For further help on getting started with &lt;code&gt;create-react-app&lt;/code&gt;, see the &lt;a href="https://reactjs.org/docs/create-a-new-react-app.html" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fkmyspzukjlq677y03neu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fkmyspzukjlq677y03neu.jpg" alt="Default React App Home"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The base project structure of our &lt;em&gt;React&lt;/em&gt; application is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react-jscrambler-boilerplate/
|-- package-lock.json
|-- package.json
|-- yarn.lock
|-- build/
| |-- static/
| | |-- css/
| | |-- js/
| | |-- media/
|-- node_modules/
|-- public/
|-- src/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;package.json&lt;/code&gt; contains all the configurations which are related to npm such as dependencies, version and scripts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;src&lt;/code&gt; directory features all the source code of the application. The sources are then built and packed into the &lt;code&gt;build&lt;/code&gt; directory. This is where our protected HTML and JavaScript files will be placed after the build.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to Configure Jscrambler
&lt;/h3&gt;

&lt;p&gt;All of Jscrambler's configuration will reside inside a single file: &lt;code&gt;.jscramblerrc&lt;/code&gt;. As such, we will need to create this file to specify which transformations we wish to use.&lt;/p&gt;

&lt;p&gt;The quickest way to achieve this is via the &lt;a href="https://app.jscrambler.com/dashboard?utm_source=dev.to&amp;amp;utm_medium=referral"&gt;Jscrambler Web App&lt;/a&gt;. Once there, create a new app. Now, in the &lt;em&gt;Application Modes&lt;/em&gt; tab, select the Language Specifications and application type. Next, select the transformations you want (check the &lt;em&gt;Templates&lt;/em&gt; and &lt;em&gt;Fine-Tuning&lt;/em&gt; tabs). In this tutorial, we'll be selecting the &lt;em&gt;Obfuscation&lt;/em&gt; template. If you need help with these steps, please refer to our &lt;a href="https://blog.jscrambler.com/jscrambler-101-how-to-use-the-cli/?utm_source=dev.to&amp;amp;utm_medium=referral"&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, we simply have to download a &lt;strong&gt;JSON file with all this configuration&lt;/strong&gt;, which will be used only for quickly getting the required settings.&lt;/p&gt;

&lt;center&gt;![Download Jscrambler JSON](https://blog.jscrambler.com/content/images/2018/08/jscrambler-101-first-use-download-json.png)&lt;/center&gt;

&lt;p&gt;Now, let's create a new file named &lt;code&gt;.jscramblerrc&lt;/code&gt; on the React project’s root folder. Open the &lt;code&gt;jscrambler.json&lt;/code&gt; file we just downloaded and copy all its contents to the &lt;code&gt;.jscramblerrc&lt;/code&gt; file. After that, we just have to add two new sections to &lt;code&gt;.jscramblerrc&lt;/code&gt;, which are &lt;code&gt;filesSrc&lt;/code&gt; and &lt;code&gt;filesDest&lt;/code&gt; (see below). Your final &lt;code&gt;.jscramblerrc&lt;/code&gt; file should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"keys"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"accessKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;ACCESS_KEY_HERE&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"secretKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;SECRET_KEY_HERE&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"applicationId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;APP_ID_HERE&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"filesSrc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="s2"&gt;"./build/**/*.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="s2"&gt;"./build/**/*.js"&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"filesDest"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"whitespaceRemoval"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"identifiersRenaming"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="nl"&gt;"mode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SAFEST"&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dotToBracketNotation"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deadCodeInjection"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stringConcealing"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"functionReordering"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="nl"&gt;"freq"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="nl"&gt;"features"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"opaqueFunctions"&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"functionOutlining"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"propertyKeysObfuscation"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"regexObfuscation"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"booleanToAnything"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"areSubscribersOrdered"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"applicationTypes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"webBrowserApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"desktopApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"serverApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"hybridMobileApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"javascriptNativeApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"html5GameApp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"languageSpecifications"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"es5"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"es6"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"es7"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"useRecommendedOrder"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"jscramblerVersion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"5.&amp;lt;X&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we got this information directly via the Jscrambler Web App, our &lt;code&gt;accessKey&lt;/code&gt;, &lt;code&gt;secretKey&lt;/code&gt; and &lt;code&gt;applicationId&lt;/code&gt; fields are already filled. If you wish to retrieve them manually, refer to our &lt;a href="https://blog.jscrambler.com/jscrambler-101-first-use/?utm_source=dev.to&amp;amp;utm_medium=referral"&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's important to note that the &lt;code&gt;params&lt;/code&gt; section specifies the transformations that will be used to protect your React app. &lt;strong&gt;These can be hand-picked by you&lt;/strong&gt;, by selecting them in the Web App or setting them manually. You can find documentation on all the available transformations &lt;a href="https://docs.jscrambler.com/code-integrity/documentation/transformations?utm_source=dev.to&amp;amp;utm_medium=referral"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also change &lt;code&gt;filesSrc&lt;/code&gt; to match the files you need/want to protect. For our example — and all React apps — we recommend protecting the &lt;code&gt;.html&lt;/code&gt; and &lt;code&gt;.js&lt;/code&gt; files. Certainly, with a better understanding of the project, you may identify what’s critical and essential protecting.&lt;/p&gt;

&lt;p&gt;By using &lt;code&gt;filesDest: './'&lt;/code&gt;, the files we send to protect will be overwritten by their protected version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrating Jscrambler in the Build Process
&lt;/h2&gt;

&lt;p&gt;Using the CLI is likely the most common way of generating your build. We will use our boilerplate app to showcase how to integrate Jscrambler into the build process.&lt;/p&gt;

&lt;p&gt;The first step of our integration with &lt;em&gt;Jscrambler&lt;/em&gt; is installing the &lt;a href="https://github.com/jscrambler/jscrambler/tree/master/packages/jscrambler-cli" rel="noopener noreferrer"&gt;Jscrambler API Client&lt;/a&gt;. Simply run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i jscrambler &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To integrate Jscrambler in our application's build process via the CLI, we need to create a CLI hook in the &lt;em&gt;scripts&lt;/em&gt; section of &lt;code&gt;package.json&lt;/code&gt;. The section should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-scripts start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-scripts build &amp;amp;&amp;amp; jscrambler"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-scripts test"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"eject"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-scripts eject"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The specific &lt;code&gt;"build": "react-scripts build &amp;amp;&amp;amp; jscrambler"&lt;/code&gt; hook will trigger the &lt;code&gt;jscrambler&lt;/code&gt; command after the build process is finished.&lt;/p&gt;

&lt;p&gt;In order for this command to be executable, &lt;strong&gt;we need to make sure that the &lt;code&gt;.jscramblerrc&lt;/code&gt; file that we created before is in our project's root folder&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We are now ready to protect our code and build our application via the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create the protected production files on &lt;code&gt;build/static/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And you're done! Now all your HTML and JavaScript files are protected with Jscrambler against code theft and reverse-engineering. Remember that you can always fine-tune your protections to manage eventual performance hits. If that's the case, be sure to follow our &lt;a href="https://blog.jscrambler.com/jscrambler-101-code-annotations/?utm_source=dev.to&amp;amp;utm_medium=referral"&gt;tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you have ejected your project, you can also protect the files using the Jscrambler &lt;a href="https://github.com/jscrambler/jscrambler/tree/master/packages/jscrambler-webpack-plugin" rel="noopener noreferrer"&gt;webpack plugin&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the Protected React App
&lt;/h2&gt;

&lt;p&gt;As a final step, let's check if the app is running successfully with the newly-protected source code. Start by installing the required dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let's simply deploy the app build files to a local development server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;serve &lt;span class="nt"&gt;-s&lt;/span&gt; build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, as you should be able to see on the terminal, you can run this server on two ports. One which is publicly available, and another which is specific to your machine.&lt;/p&gt;

&lt;p&gt;Open the provided URL and your app will start in the browser.&lt;/p&gt;

&lt;p&gt;You can now check what your protected files look like. This can be achieved simply by opening the browser's debugger and opening the files from the "Sources" tab. The protected code should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3gibi73lub7dhjkzq8lo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3gibi73lub7dhjkzq8lo.jpg" alt="Protected React Code - Chrome Debugger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There are no doubts that &lt;em&gt;React&lt;/em&gt; is a crowd favorite, from individual developers to large enterprises.&lt;/p&gt;

&lt;p&gt;If you're building React applications which have sensitive logic, want to prevent &lt;strong&gt;reverse-engineering, licensing violations, and tampering&lt;/strong&gt;, a security solution such as Jscrambler is a must.&lt;/p&gt;

&lt;p&gt;Integrating Jscrambler into React's build process is simple and enables protecting your code with the most sophisticated &lt;strong&gt;polymorphic obfuscation&lt;/strong&gt;, &lt;strong&gt;code locks&lt;/strong&gt;, and &lt;strong&gt;self-defensive&lt;/strong&gt; capabilities.&lt;/p&gt;

&lt;p&gt;This all comes with premium support, so be sure to &lt;a href="//mailto:support@jscrambler.com"&gt;contact the Jscrambler support team&lt;/a&gt; if you have any questions!&lt;/p&gt;

</description>
      <category>jscrambler</category>
      <category>react</category>
      <category>javascript</category>
      <category>security</category>
    </item>
  </channel>
</rss>
