MeLight
MeLight

Reputation: 5565

Packaging Chrome extension with a predefined key

I'm testing extension update. I'd like to test it with the extension from the store. I'm able to load the extension with the desired key (defined through manifest.json) through chrome://extensions Load unpacked extension, but as soon as I pack it the key changes - both when using the my_extension.pem and without it.

Is it possible to pack an extension with the same key it has in the Chrome Web Store?

Upvotes: 2

Views: 2267

Answers (1)

Rob W
Rob W

Reputation: 349042

The extension ID is directly calculated from "key", which in turn is based on the .pem file that is used for packaging the extension.

For development, you can set your extension ID to any arbitrary value you want, provided that you've got the key for that extension ID. However, you cannot package an extension with an arbitrary extension ID, unless you've got the .pem file from which the key can be derived.

If you did not include a file called key.pem when you uploaded your extension to the Chrome Web Store for the first time, then you cannot create a CRX file with the given extension ID, because the .pem file will then only be known by the Chrome Web Store (the .pem file is auto-generated by the CWS if omitted).

However, you can load an unpacked extension with your preferred extensionID by setting the "key" in the manifest file, see How to change chrome packaged app id Or Why do we need key field in the manifest.json? for more details.

Upvotes: 4

Related Questions