# Muse DRM

{% hint style="info" %}
Applies only to commercial (paid) Applications and Plugins

Muse DRM is not suited as a protection for **Electron apps**, that should use [Muse SDK](https://developer.musehub.com/muse-partners-help/resources/muse-sdk) instead.
{% endhint %}

Muse DRM is an important part of the MuseHub platform because it ensures product ownership, and enables commercial business models such as pay-once, subscription and free trials (as well as refunds) to be handled.&#x20;

For customers, they experience a seamless acquisition process and are never aware of any license management, since it's handled seamlessly by the Hub.&#x20;

For developers, this means you don't need to invest in costly and complex 3rd party solutions, or spend a long time building your own.

## MuseHub Developer Utility

As a MuseHub Partner, you gain access to our developer tooling, including the MuseHub Developer Utility. This can be used to easily apply Muse DRM through a quick, simple process which can be optionally integrated into your build pipeline.

The MuseHub Developer Utility is a no-code tool that integrates your product with MuseHub's technology. It creates a MuseHub compatible version of your application binary, enabling license verification. If a valid license is detected, the application or plugin binary executes. Otherwise, the binary is blocked, and a notification window informs the user of the invalid or missing license.

{% hint style="success" %}
The macOS version of the Developer Utility can wrap macOS and Windows binaries.&#x20;

The Windows version of the Developer Utility can wrap Windows binaries **only**.&#x20;
{% endhint %}

## Usage

The MuseHub Developer Utility can be operated via a simple command line interface (CLI), and can be easily built into scripts for automation.  For Muse DRM to operate succesfully, your product must be free from other DRM solutions.

Before you start, you'll need:

* Your user-specific [API key](https://developer.musehub.com/muse-partners-help/getting-started/generate-api-keys)
* The product's `product_id` which is generated when you add a product in the Partner Portal, and shown in the top left of the Partner Portal (labelled as either an application\_id or effect\_id).
* An "open" build of your product free from any DRM or other license management systems.

Once you're ready to go, run the musedrm tool with the following usage:

{% code title="Application example" overflow="wrap" %}

```
musedrm --protect [your app.app] --api_key [your api key] --product_id [your application_id] --overwrite
```

{% endcode %}

You can protect multiple binaries within the same command, as long as they correspond to the same product on the same platform. You must wrap macOS and Windows products separately.&#x20;

For example, to protect multiple plugin formats, such as VST3, AU and AAX, which you will later bundle together in a single installer, you would run:

{% code title="Plugin example" overflow="wrap" %}

```
musedrm --protect [plugin.vst3 plugin.component plugin.aaxplugin] --api_key [your api key] --product_id [your application_id] --overwrite
```

{% endcode %}

### Parameters

* **--protect** MyProduct \[bundle or standalone product, one or more are accepted]
* **--api\_key** \<your API key>
* **--product\_id** \[GUID from the top of the product page in Cosmos]
* -**-out** \[cannot point to the original location, use --overwrite instead]
* **--overwrite** \[replaces the software with the protected version in place, used in alternative to --out]
* -**-main\_binary** Contents/MacOS/MainBinary \[OPTIONAL, bundles only, omit for auto-detect, or specify for all --protect entries]
* **--help** Only display usage information, ignoring all other arguments
* **--version** Only display the tool's version, ignoring all other arguments

{% hint style="warning" %}
Be sure to wrap the top folder of a bundle, **also on Windows** where "bundle plugins" are regular folders that contain the plugin binary.

For instance, when wrapping the recent **Windows VST3 bundles**, do not pass "plugin.vst3/Contents/x86\_64-win/plugin.vst3" to musedrm, but the top .vst3 folder:

<pre data-overflow="wrap"><code>musedrm --protect <a data-footnote-ref href="#user-content-fn-1">plugin.vst3</a> -- api_key [your api key] --product_id [your application_id] --overwrite
</code></pre>

The same goes for .aaxplugin folders.
{% endhint %}

### After wrapping

If successful, the tool will return your protected binary, plus a unique `musedrm_id` which you'll need when uploading the application or installer to the Partner Portal later.&#x20;

You can then proceed to codesign, notarise and build your installers as usual.&#x20;

{% hint style="warning" %}
Be sure to wrap your product **before** you codesign.&#x20;
{% endhint %}

## Developer Notes:

Audio Units built with Xcode 15 may return a CLI error:

* It's been reported that Audio Unit components built with Xcode 15 require a special linker flag to avoid corruption through the DRM process. Without this build flag, your AU component may return an error in the Muse DRM CLI tool. To resolve, add the `-Wl,-headerpad,0x1000` to the "Other Linker Flags" section of Xcode's build settings for your project.&#x20;

[^1]: This is the "plugin.vst3/" folder, NOT the "plugin.vst3/Contents/x86\_64-win/plugin.vst3" binary file in it!
