Getting my plugin working on mobile devices

How can I make my plugin work on mobile devices?

So I have plenty of experience in Java & C# and a bit in JS, but this is my first time ever with Node.js so forgive any ignorance :slight_smile:

I made a plugin to encrypt (or at least obfuscate) some selected text. Here is basically how it works:

  • The user selects some text and
  • inputs a passphrase into a dialog modal
  • Passphrase gets hashed,
  • and is used (along with generated IV) to encrypt the text.
  • selected text is replaced with encryption result

The IV is randomly generated but will be needed later to decrypt, so for now it is just formatted onto the note with the encrypted text.


Here is a demonstration of how the IV is stored with the encrypted text. It is shown in more detail in the ReadMe.

And it works reliably enough on a PC.

However it doesn’t work on Obsidian on my phone (Android app):

Android capture (gif)

The modal appears, and once submitted, it looks like for moment something is happening with the selected text.

So before I start a painstaking Android debugging process - does anyone have a hunch to point me in the right direction? I’m hoping there’s just some alternate API call that works on any device.

Or of possible workarounds I was considering trying different approaches like outputting the result to the clipboard, and notifying the user to paste it where they’d like.

Or if there were just a clean way to get access to the developer console on the Android app it would make things easier.

The results are the same using a command, but everything here is happening on the single ribbon icon’s click (line 32) and the resulting functions like the password submission (try on line 87).

You are using the crypto and buffer libraries in your code, which are NodeJS specific, NodeJS libraries can only be used in the desktop build of obsidian.

To get Dev Tools on Android you can use this guide from @koala in the obsidian discord:

How to test plugins on Android
I think you need to have ADB on your computer installed (I always had that installed; if the following directions don’t work without it, install it and activate it on your phone); on your android phone enable ADB (it’s under developer settings [tap the build number three times to get these settings]); then connect the phone to your computer over USB; open chrome (or chromium based browser should also work) and type chrome://inspect in the browser. Open obsidian on your phone, then it should appear in the browser. You will have the console and the inspector like you have for desktop Obsidian.

You plugins also seems similar to this plugin (which should work on mobile), might want to differentiate between the two in the readme.