Added key generation logic for bookmarklet