Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate Chrome extension ID from private keys #72

Open
js-choi opened this issue May 23, 2017 · 1 comment · May be fixed by #85
Open

Calculate Chrome extension ID from private keys #72

js-choi opened this issue May 23, 2017 · 1 comment · May be fixed by #85
Labels

Comments

@js-choi
Copy link

js-choi commented May 23, 2017

It is useful to calculate the Chrome extension ID corresponding to a given a private key. For instance, in order to run WebDriver functional tests for any Google Extension using Selenium–ChromeDriver, the extension ID is necessary to get the URLs of extension pages (background and popup pages).

As Erik Kay says on Stack Overflow, any extension’s ID is the first 128 bits of the SHA256 of its RSA public key encoded in base 16 from a to p. CLI examples from Rob Wu and a Ruby script by Mark Wubben might also be useful to look at.

The module API would be similar to crx.generateExtensionID() or ChromeExtension.getExtensionIdFor(privateKeyBuffer), and the CLI would be similar to crx genid -p private-key. The interfaces might also support public keys as inputs, since any private keys would simply be converted to public keys anyway, but this flexibility should be weighed against API simplicity.

@thom4parisot
Copy link
Owner

Hello @js-choi, I was not aware of this feature but yes, it would be a good addition.

I would indeed favour a #getExtensionIdFor(publicKeyBuffer) to return a promise, because the public key is the real dependency. The #generatePublicKey() method would provide the required data if it is not already available within the workflow:

crx.generatePublicKey()
  .then(pubKey => crx.getExtensionIdFor(pubKey))
  .then(id => ...)

I can't remember if there is any value of storing the pubkey somewhere — it is the only thing provided by the Chrome Web Store though.

@thom4parisot thom4parisot linked a pull request Mar 20, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants