Web Crypto, Keygen, encryption, license keys, or other authentication solution for paid plugin—please

Hello,

I’ve been developing an Obsidian plugin for the past 6+ months, nearing completion. I intend for it to be a paid plugin, with a free option. For updates, I would like it available in the Community Plugins store, with a setting in the Obsidian plugin settings to allow the user to put in a license key after paying on my website to validate that they are a premium user over a free user.

I may even have them “log in” in the settings page to pull their license key automatically, but that has nothing to do with what I’m asking now.

More on that later or anything you’re curious about I can share, but I need help with getting any form of paid option to work so I can actually roll out what I built.

I landed on Keygen, and I’ve talked to its founder, who graciously built this for me after I told him I needed a “front-end only” solution and that Obsidian is like a web browser. :point_down:

I hope I’m not violating any rules here, but the below link is pretty essential to what I’m trying to do

github dot com /keygen-sh/example-js-cryptographic-license-files/tree/master

I told him I wanted ultimately for the decryption to happen offline and not require node.js server calls or anything. Unfortunately I found the problem that not all browsers (only Firefox AFAIK) can even run this, and I get the exact same error in Obsidian console as I do on Chromium browsers.

that error being:

DOMException: Failed to execute 'importKey' on 'SubtleCrypto': Algorithm: Unrecognized name
    at originalSubtleCrypto.importKey

or virtually synonymous on other browsers.

This happens with the various linked polyfills as well as using the original functions. I’ve determined it’s at the browser level, where the Web Crypto standard is not widely implemented yet, and it seems not supported in Obsidian either.

Actually I don’t care one bit that it works on any “browser” other than Obsidian. This is only an Obsidian plugin, not a web project.

This is a big blockage for me in my project, which is almost done and which ties into a lot I’m trying to launch with my brand.

Being aware that Obsidian plugins are pure JS, I’m only looking for any kind of way to securely validate a license or credential that I can then check around the rest of my plugin or Templater JS to allow or disallow certain features. I don’t need it to be bulletproof. Based on what my plugin is, I only want to create extra steps where an end user would have to deconstruct my plugin code a bit to steal it. However, if you know a way to easily make it bulletproof, please share.

Can someone please point out my error or explain what’s needed to make that above GitHub example run inside Obsidian? Alternatively, is there a working recommended solution for authenticating or validating a paid user over a free one inside Obsidian? Is that a feature within the Community Plugins store, or maybe this has been done before?

I can answer any questions to fill in any blanks and even edit this OP, but getting some kind of authentication/validation is all that I need, regardless of the rest of the details of my project.

Thank you!

All the best,
Mike Legend