Provides a sets of tools packing, unpacking, zip, unzip, download, gen id, etc...
- Code examples
- Installation
- Dev commands
- Examples
- Encode to base64 string
- PublicKey from extension
- Pack a zip file or unzipped directory into a crx extension
- Unpack chrome extension into current directory
- Download a chrome extension from the web store
- Add unpacked extension to archive
- Unzip an extension to the directory
- Keygen
- Generate extension id
- IsDir, IsZip, IsCRX3 helpers
- Load or save private key
- License
go get -u github.com/mediabuyerbot/go-crx3/crx3
go install github.com/mediabuyerbot/go-crx3/crx3@latest
OR download the binary from here
https://github.com/mmadfox/go-crx3/releases
$ make proto
$ make test/cover
import crx3 "github.com/mediabuyerbot/go-crx3"
if err := crx3.Extension("/path/to/file.zip").Pack(nil); err != nil {
panic(err)
}
import crx3 "github.com/mediabuyerbot/go-crx3"
pk, err := crx3.LoadPrivateKey("/path/to/key.pem")
if err != nil {
panic(err)
}
if err := crx3.Extension("/path/to/file.zip").Pack(pk); err != nil {
panic(err)
}
import crx3 "github.com/mediabuyerbot/go-crx3"
pk, err := crx3.LoadPrivateKey("/path/to/key.pem")
if err != nil {
panic(err)
}
if err := crx3.Extension("/path/to/file.zip").PackTo("/path/to/ext.crx", pk); err != nil {
panic(err)
}
$ crx3 pack /path/to/file.zip
$ crx3 pack /path/to/file.zip -p /path/to/key.pem
$ crx3 pack /path/to/file.zip -p /path/to/key.pem -o /path/to/ext.crx
import crx3 "github.com/mediabuyerbot/go-crx3"
if err := crx3.Extension("/path/to/ext.crx").Unpack(); err != nil {
panic(err)
}
$ crx3 unpack /path/to/ext.crx
import crx3 "github.com/mediabuyerbot/go-crx3"
import "fmt"
b, err := crx3.Extension("/path/to/ext.crx").Base64()
if err != nil {
panic(err)
}
fmt.Println(string(b))
$ crx3 base64 /path/to/ext.crx [-o /path/to/file]
import crx3 "github.com/mediabuyerbot/go-crx3"
pubkey, signature, err := crx3.Extension("/path/to/ext.crx").PublicKey()
$ crx3 pubkey /path/to/ext.crx [-o /path/to/file]
import crx3 "github.com/mediabuyerbot/go-crx3"
extensionID := "blipmdconlkpinefehnmjammfjpmpbjk"
filepath := "/path/to/ext.crx"
if err := crx3.DownloadFromWebStore(extensionID,filepath); err != nil {
panic(err)
}
$ crx3 download blipmdconlkpinefehnmjammfjpmpbjk [-o /custom/path]
$ crx3 download https://chrome.google.com/webstore/detail/lighthouse/blipmdconlkpinefehnmjammfjpmpbjk
import crx3 "github.com/mediabuyerbot/go-crx3"
if err := crx3.Extension("/path/to/unpacked").Zip(); err != nil {
panic(err)
}
$ crx3 zip /path/to/unpacked [-o /custom/path]
import crx3 "github.com/mediabuyerbot/go-crx3"
if err := crx3.Extension("/path/to/ext.zip").Unzip(); err != nil {
panic(err)
}
$ crx3 unzip /path/to/ext.zip [-o /custom/path]
import crx3 "github.com/mediabuyerbot/go-crx3"
id, err := crx3.Extension("/path/to/ext.crx").ID()
if err != nil {
panic(err)
}
$ crx3 id /path/to/ext.crx
import crx3 "github.com/mediabuyerbot/go-crx3"
crx3.Extension("/path/to/ext.zip").IsZip()
crx3.Extension("/path/to/ext").IsDir()
crx3.Extension("/path/to/ext.crx").IsCRX3()
import crx3 "github.com/mediabuyerbot/go-crx3"
pk, err := crx3.NewPrivateKey()
if err != nil {
panic(err)
}
if err := crx3.SavePrivateKey("/path/to/key.pem", pk); err != nil {
panic(err)
}
pk, err = crx3.LoadPrivateKey("/path/to/key.pem")
$ crx3 keygen /path/to/key.pem
go-crx3 is released under the Apache 2.0 license. See LICENSE.txt