Documentation ¶
Index ¶
- Constants
- Variables
- func Base64(filename string) (b []byte, err error)
- func DownloadFromWebStore(extensionID string, filename string) error
- func ID(filename string) (id string, err error)
- func LoadPrivateKey(filename string) (ed25519.PrivateKey, error)
- func LoadPublicKey(filename string) (ed25519.PublicKey, error)
- func NewPrivateKey() (ed25519.PrivateKey, error)
- func Pack(src string, dst string, pk ed25519.PrivateKey) (err error)
- func SavePrivateKey(filename string, key ed25519.PrivateKey) error
- func SetWebStoreURL(u string)
- func Unpack(filename string, out *string, key *string, isPEM bool) error
- func Unzip(r io.ReaderAt, size int64, unpacked string) error
- func Zip(w io.Writer, unpacked string) error
- type Extension
- func (e Extension) Base64() ([]byte, error)
- func (e Extension) ID() (string, error)
- func (e Extension) IsCRX3() bool
- func (e Extension) IsDir() bool
- func (e Extension) IsZip() bool
- func (e Extension) Pack(pk ed25519.PrivateKey) error
- func (e Extension) PackTo(dst string, pk ed25519.PrivateKey) error
- func (e Extension) String() string
- func (e Extension) Unpack() error
- func (e Extension) Unzip() error
- func (e Extension) Zip() error
Constants ¶
const CRX3_SIGNED_DATA = "CRX3 SignedData\x00"
Variables ¶
var ( ErrUnknownFileExtension = errors.New("crx3: unknown file extension") ErrUnsupportedFileFormat = errors.New("crx3: unsupported file format") ErrExtensionNotSpecified = errors.New("crx3: extension id not specified") ErrPathNotFound = errors.New("crx3: filepath not found") ErrPrivateKeyNotFound = errors.New("crx3: private key not found") ErrPublicKeyNotFound = errors.New("crx3: public key not found") ErrPublicKeyNotPermitted = errors.New("crx3: public key not permitter") ErrSignatureDoesNotMatch = errors.New("crx3: the signature does not match") ErrPathDoesNotDirectory = errors.New("crx3: the path does not directory") )
Functions ¶
func Base64 ¶
Base64 encodes an extension file to a base64 string. It returns a bytes and an error encountered while encodes, if any.
func DownloadFromWebStore ¶
DownloadFromWebStore downloads a chrome extension from the web store. ExtensionID can be an identifier or an url.
func LoadPrivateKey ¶
func LoadPrivateKey(filename string) (ed25519.PrivateKey, error)
LoadPrivateKey loads the private key from a file into memory.
func LoadPublicKey ¶
LoadPublicKey loads the public key from a file into memory.
func NewPrivateKey ¶
func NewPrivateKey() (ed25519.PrivateKey, error)
NewPrivateKey returns a new private key.
func Pack ¶
func Pack(src string, dst string, pk ed25519.PrivateKey) (err error)
Pack packs a zip file or unzipped directory into a crx extension.
func SavePrivateKey ¶
func SavePrivateKey(filename string, key ed25519.PrivateKey) error
SavePrivateKey saves private key to file.
func SetWebStoreURL ¶
func SetWebStoreURL(u string)
SetWebStoreURL sets the web store url to download extensions.
Types ¶
type Extension ¶
type Extension string
func (Extension) Pack ¶
func (e Extension) Pack(pk ed25519.PrivateKey) error
Pack packs zip file or an unpacked directory into a CRX3 file.
func (Extension) PackTo ¶
func (e Extension) PackTo(dst string, pk ed25519.PrivateKey) error
PackTo packs zip file or an unpacked directory into a CRX3 file.