Public API source, private implementation?

Hello,

Is it possible to release a library without its source code? Only the public interfaces should be open.

Also, It’s a business constraint I can’t control :slight_smile:

Technically yes, you can compile with --no-debug-info and distribute .beam files (or use encrypted debug info, see Erlang compiler doc). As expected from a bytecode language it’s not very difficult to reverse engineer though, and it might take some trickery to make it work with Mix and Hex.

1 Like

Hmm, not sure if it’s what you mean, or are after, but…

The only way I can think of would be to have the source code, and thus business logic behind a web API, and the library you distribute is just a helper lib around that API.

The same as you don’t have access to something like Stripe or Mailchimp’s source code, but can install a package from them to provide certain functionality.

1 Like

That’s what I thought too. Helper lib + dev server with custom environment per project/developer/whatever

But sometimes bosses can be… well, you know… bosses.

Thanks!

I’ll try that. I just need a proof that this is indeed a bad idea!

Yeah, stripping the release of debug_info would make it impossible to recover the original source code, but reverse-engeneering the BEAM assembly for somebody that is well versed in it, isn’t particularly hard. The assembly needs to be there since that’s what will be ultimately executed.

1 Like