Documentation ¶
Index ¶
- Constants
- type AwsCredentials
- type Channel
- type ChannelOption
- type Cipher
- type Contract
- type EnvironmentProvider
- type Key
- func (k Key) Contract() int32
- func (k Key) Expires() time.Time
- func (k Key) IsEmpty() bool
- func (k Key) IsExpired() bool
- func (k Key) IsMaster() bool
- func (k Key) Master() uint16
- func (k Key) Permissions() uint32
- func (k Key) Salt() uint16
- func (k Key) SetContract(value int32)
- func (k Key) SetExpires(value time.Time)
- func (k Key) SetMaster(value uint16)
- func (k Key) SetPermissions(value uint32)
- func (k Key) SetSalt(value uint16)
- func (k Key) SetSignature(value int32)
- func (k Key) SetTarget(value uint32)
- func (k Key) Signature() int32
- func (k Key) Target() uint32
- type License
- type Provider
- type VaultProvider
Constants ¶
const ( ChannelInvalid = uint8(iota) ChannelStatic ChannelWildcard )
Channel types
const ( AllowNone = uint32(0) // Key has no privileges. AllowMaster = uint32(1 << 0) // Key should be allowed to generate other keys. AllowRead = uint32(1 << 1) // Key should be allowed to subscribe to the target channel. AllowWrite = uint32(1 << 2) // Key should be allowed to publish to the target channel. AllowStore = uint32(1 << 3) // Key should be allowed to write to the message history of the target channel. AllowLoad = uint32(1 << 4) // Key should be allowed to write to read the message history of the target channel. AllowPresence = uint32(1 << 5) // Key should be allowed to query the presence on the target channel. AllowReadWrite = AllowRead | AllowWrite // Key should be allowed to read and write to the target channel. AllowStoreLoad = AllowStore | AllowLoad // Key should be allowed to read and write the message history. )
Access types for a security key.
const ( LicenseTypeUnknown = iota LicenseTypeCloud LicenseTypeOnPremise )
Various license types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwsCredentials ¶
type AwsCredentials struct { AccessKey string `json:"access_key"` // The access key. SecretKey string `json:"secret_key"` // The secret key. Token string `json:"security_token"` // The token. Duration time.Duration `json:"-"` // The duration of the credentials. Expires time.Time `json:"-"` // The expiration date of the credentials. }
AwsCredentials represents Amazon Web Services credentials.
type Channel ¶
type Channel struct { Key []byte // Gets or sets the API key of the channel. Channel []byte // Gets or sets the channel string. Query []uint32 // Gets or sets the full ssid. Options []ChannelOption // Gets or sets the options. ChannelType uint8 }
Channel represents a parsed MQTT topic.
func ParseChannel ¶
ParseChannel attempts to parse the channel from the underlying slice.
type ChannelOption ¶
ChannelOption represents a key/value pair option.
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
Cipher represents a security cipher which can encrypt/decrypt security keys.
func (*Cipher) DecryptKey ¶
DecryptKey decrypts the security key from a base64 encoded string.
type Contract ¶
type Contract interface {
Validate(key Key) bool // Validate checks the security key with the contract.
}
Contract represents an interface for a contract.
type EnvironmentProvider ¶
type EnvironmentProvider struct { }
EnvironmentProvider represents a security provider which uses environment variables to store secrets.
type Key ¶
type Key []byte
Key represents a security key.
func (Key) SetExpires ¶
SetExpires sets the expiration date for the key.
func (Key) SetPermissions ¶
SetPermissions sets the permission flags.
func (Key) SetSignature ¶
SetSignature sets the signature of the contract.
type License ¶
type License struct { EncryptionKey string // Gets or sets the encryption key. Contract int32 // Gets or sets the contract id. Signature int32 // Gets or sets the signature of the contract. Expires time.Time // Gets or sets the expiration date for the license. Type uint32 // Gets or sets the license type. }
License represents a security license for the service.
func ParseLicense ¶
ParseLicense decrypts the license and verifies it.
type Provider ¶
type Provider interface { config.SecretStore }
Provider represents a contract for a security provider.
func NewEnvironmentProvider ¶
func NewEnvironmentProvider() Provider
NewEnvironmentProvider creates a new environment security provider.
type VaultProvider ¶
type VaultProvider struct {
// contains filtered or unexported fields
}
VaultProvider represents a security provider which uses hashicorp vault to store secrets.
func NewVaultProvider ¶
func NewVaultProvider(user string) *VaultProvider
NewVaultProvider creates a new environment security provider.