hostmanifest

package
v1.0.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2017 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 0

README

Native Messaging Host Manifest

This library handles installing and uninstalling NativeMessaging host manifests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KnownInstallers

func KnownInstallers() map[string]Installer

KnownInstallers returns a map of browser-to-Installer that this package knows about for this platform.

Types

type App

type App struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Path        string `json:"path"`
	Type        string `json:"type"`
}

App contains the metadata that defines a NativeMessaging app.

func (App) BinPath

func (app App) BinPath() string

BinPath returns the path of the binary for the NativeMessaging app target.

func (App) ID

func (app App) ID() string

ID returns the app identifier

type AppManifest

type AppManifest interface {
	// ID returns the app identifier, usually the same as the name.
	ID() string
	// BinPath returns the path of the binary for the NativeMessaging app target.
	BinPath() string
}

AppManifest is a serializable App metadata container

type ChromeApp

type ChromeApp struct {
	App
	AllowedOrigins []string `json:"allowed_origins"`
}

ChromeApp is the App metadata but includes Chrome-specific fields.

type FirefoxApp

type FirefoxApp struct {
	App
	AllowedExtensions []string `json:"allowed_extensions"`
}

FirefoxApp is the App metadata but includes Firefox-specific fields.

type Installer

type Installer interface {
	Install(u User, app AppManifest) error
	Uninstall(u User, app AppManifest) error
}

Installer handles writing whitelist information for enabling the NativeMessaging app.

type User

type User interface {
	// IsAdmin returns true if the user is root, usually uid == 0
	IsAdmin() bool
	// PrefixPath is where paths relative to that user should be. Usually $HOME.
	PrefixPath() string
}

User is an interface for an OS user.

type UserPath

type UserPath struct {
	Admin bool
	Path  string
}

UserPath is a straightforward implementation of User.

func CurrentUser

func CurrentUser() (*UserPath, error)

CurrentUser returns a UserPath representing the current user.

func (*UserPath) IsAdmin

func (u *UserPath) IsAdmin() bool

IsAdmin implements User.

func (*UserPath) PrefixPath

func (u *UserPath) PrefixPath() string

PrefixPath implements User.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL