Documentation
¶
Index ¶
- Variables
- func CheckEditorName(editorName string) error
- func DecryptMasterSecret(content, passphrase []byte) ([]byte, error)
- func EncryptMasterSecret(secret, passphrase []byte) ([]byte, error)
- func GenerateMasterSecret() []byte
- func IsSecretClear(secret []byte) bool
- func VerifyTokenAuthentication(masterSecret, token []byte) bool
- type Editor
- func (e *Editor) AutoPublication() bool
- func (e *Editor) GenerateEditorToken(masterSecret []byte, maxAge time.Duration, appName string) ([]byte, error)
- func (e *Editor) GenerateMasterToken(masterSecret []byte, maxAge time.Duration) ([]byte, error)
- func (e *Editor) IsComplete() bool
- func (e *Editor) MarshalJSON() ([]byte, error)
- func (e *Editor) Name() string
- func (e *Editor) VerifyEditorToken(masterSecret, token []byte, appName string) bool
- func (e *Editor) VerifyMasterToken(masterSecret, token []byte) bool
- type EditorRegistry
- type Vault
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEditorNotFound = errshttp.NewError(http.StatusNotFound, "Editor not found") ErrEditorExists = errshttp.NewError(http.StatusConflict, "Editor already exists") ErrBadEditorName = errshttp.NewError(http.StatusBadRequest, "Editor name should only contain alphanumeric characters") ErrMissingPassphrase = errors.New("Missing passphrase") )
Functions ¶
func CheckEditorName ¶
func DecryptMasterSecret ¶
func EncryptMasterSecret ¶
func GenerateMasterSecret ¶
func GenerateMasterSecret() []byte
func IsSecretClear ¶
Types ¶
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
func NewEditorForTest ¶
func (*Editor) AutoPublication ¶
func (*Editor) GenerateEditorToken ¶
func (*Editor) GenerateMasterToken ¶
func (*Editor) IsComplete ¶
func (*Editor) MarshalJSON ¶
func (*Editor) VerifyEditorToken ¶
func (*Editor) VerifyMasterToken ¶
type EditorRegistry ¶
type EditorRegistry struct {
Vault
}
var Editors *EditorRegistry
Editors is the default registry for editors. In theory, I would have preferred to avoid using a global variable, or moved it to the base package. But it is quite complex to do so, so let's keep it here for now.
func NewEditorRegistry ¶
func NewEditorRegistry(vault Vault) *EditorRegistry
func (*EditorRegistry) CreateEditorWithoutPublicKey ¶
func (r *EditorRegistry) CreateEditorWithoutPublicKey(editorName string, autoPublication bool) (*Editor, error)
func (*EditorRegistry) RevokeEditorTokens ¶
func (r *EditorRegistry) RevokeEditorTokens(editor *Editor) error
func (*EditorRegistry) RevokeMasterTokens ¶
func (r *EditorRegistry) RevokeMasterTokens(editor *Editor) error
Click to show internal directories.
Click to hide internal directories.