-3

I'm looking for a way to share a React Native component with 3rd parties without having to share the actual source code.

Something like a .jar in Java or a .dll for C#.

enter image description here

So assuming we have company A and company B, i (as company B) am looking for a way to provide a react native library to company A without being able to navigate through my source code.

Ideally I want others to be able to

import CustomComponent from '...myCustomComponent';

but not being able to look in the actual code.

Any thoughts are welcome.

Gr3at
  • 121
  • 3
  • see [Why is "Is it possible to:" a poorly worded question?](https://softwareengineering.meta.stackexchange.com/a/7274/31260) – gnat Apr 05 '21 at 13:42
  • Thanks for your input. I understand it seems like a request for feasibility study by the community but it really isn't. Maybe it is not the right place to ask the question. A yes or no answer from someone who had a similar problem in the past would be ok (so that i know i should/shouldn't waste any more time). A pointing direction would be even better for sure. Thanks anyway. Will keep looking for alternatives. – Gr3at Apr 05 '21 at 13:52
  • 1
    Can't bring myself to close this one, especially with the close reason the other community members have chosen. This isn't a request for code-writing assistance; it is a question about deployment. – Robert Harvey Apr 05 '21 at 14:51
  • There is something called a "Web Assembly" that may allow what you desire. The link here may be a start to answer your question: https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm Problem with Javascript is that it can be uglified, minified, and obfuscated--but not provided as a binary. – Berin Loritsch Apr 05 '21 at 20:26
  • This is the spec: https://webassembly.org/ – Berin Loritsch Apr 05 '21 at 20:28
  • Thank you all for your comments. @BerinLoritsch I have looked into Web Assembly in the past but i've always considered it as a mean of performance boost for graphics due to higher required coding effort. Your approach looks promising (apart from currently being the only one proposed :-) ). I had a quick look into it and found an npm [module](https://www.npmjs.com/package/react-native-wasm) to bring Web Assembly in the desired platforms (ios, android). – Gr3at Apr 06 '21 at 06:38

1 Answers1

0

Following Berin Loritsch's commented suggestion, i looked into Web assembly as a solution.

So just putting my findings here for possible future reference.

Objective

Share react native components with third parties, while hiding as much code as possible.

Possible solutions (until now)

  1. Minify, obfuscate and/or uglify js code altogether.

    • pros: easy to implement.
    • cons: doesn't actually hides any part of the code.
  2. Utilize Web Assembly for parts of the business logic

    • pros:
      • it also proivdes a performance boost for cpu hungry operations.
      • the compiled wasm file is not that easy to decompile and follow the logic.
    • cons:
      • addition of extra complexity - i.e. more programming languages in the game.
      • requires a WebView to actually utilize Web Assembly.
  3. Take advantage of the underlying C++ capabilities existing both for IOS and Android platforms and implement parts of the business logic there.

    • pros:
      • close to chip => higher performance.
      • compiled library => as secure/hiden as possible (i think).
    • cons: more difficult/time consumming to implement.
  4. Move as much logic as possible in a backend system and provide an API.

Gr3at
  • 121
  • 3