Documentation ¶
Index ¶
- Constants
- func CompareHashAndPassword(hashedPassword []byte, bncSalt []byte, specialSalt []byte, password string) bool
- func GenerateFromPassword(bncSalt []byte, specialSalt []byte, password string) ([]byte, error)
- func InitDB(path string)
- func NewSalt() []byte
- func UpgradeDB(path string)
- type DataStore
- func (ds *DataStore) AuthUser(username string, password string) (string, bool)
- func (ds *DataStore) DelConnection(connection *ircbnc.ServerConnection) error
- func (ds *DataStore) GetAllUsers() []*ircbnc.User
- func (ds *DataStore) GetUserById(id string) *ircbnc.User
- func (ds *DataStore) GetUserByUsername(username string) *ircbnc.User
- func (ds *DataStore) GetUserNetworks(userId string)
- func (ds *DataStore) Init(manager *ircbnc.Manager) error
- func (ds *DataStore) LoadSalt() error
- func (ds *DataStore) SaveConnection(connection *ircbnc.ServerConnection) error
- func (ds *DataStore) SaveUser(user *ircbnc.User) error
- func (ds *DataStore) SetUserPassword(user *ircbnc.User, newPassword string)
- func (ds *DataStore) Setup() error
- type ServerConnectionAddressMapping
- type ServerConnectionBufferMapping
- type ServerConnectionMapping
- type UserInfo
- type UserPermissions
Constants ¶
View Source
const ( // key for the primary salt used by the ircd KeySalt = "crypto.salt" // KeyUserInfo stores the general info of a specific user in our database KeyUserInfo = "user.info %s" // KeyUserPermissions stores the permissions that the given user has access to KeyUserPermissions = "user.permissions %s" KeyServerConnectionInfo = "user.server.info %s %s" KeyServerConnectionAddresses = "user.server.addresses %s %s" KeyServerConnectionBuffers = "user.server.channels %s %s" )
Variables ¶
This section is empty.
Functions ¶
func CompareHashAndPassword ¶
func CompareHashAndPassword(hashedPassword []byte, bncSalt []byte, specialSalt []byte, password string) bool
CompareHashAndPassword compares an ircbnc hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.
func GenerateFromPassword ¶
GenerateFromPassword takes our salts and encrypts the given password.
Types ¶
type DataStore ¶
type DataStore struct { ircbnc.DataStoreInterface Db *buntdb.DB Manager *ircbnc.Manager // contains filtered or unexported fields }
func (*DataStore) DelConnection ¶
func (*DataStore) GetAllUsers ¶
func (ds *DataStore) GetAllUsers() []*ircbnc.User
func (*DataStore) GetUserById ¶
func (*DataStore) GetUserByUsername ¶
func (*DataStore) GetUserNetworks ¶
func (*DataStore) SaveConnection ¶
func (*DataStore) SetUserPassword ¶
type ServerConnectionAddressMapping ¶
type ServerConnectionAddressMapping struct { Host string Port int UseTLS bool `json:"use-tls"` VerifyTLS bool `json:"verify-tls"` }
ServerConnectionAddressMapping maps ServerConnectionAddress to its JSON structure
type ServerConnectionBufferMapping ¶
type ServerConnectionBufferMapping struct { Channel bool Name string Key string UseKey bool `json:"use_key"` LastSeen int64 `json:"last_seen"` }
ServerConnectionBufferMapping maps ServerConnectionBuffer to its JSON structure
type ServerConnectionMapping ¶
type ServerConnectionMapping struct { Name string Enabled bool ConnectPassword string `json:"connect-password"` Nickname string NicknameFallback string Username string Realname string }
ServerConnectionMapping maps ServerConnection to its JSON structure
type UserInfo ¶
type UserInfo struct { ID string Name string `json:"username"` Role string EncodedSalt string `json:"salt"` EncodedPasswordHash string `json:"hash"` DefaultNick string `json:"default-nick"` DefaultNickFallback string `json:"default-nick-fallback"` DefaultUsername string `json:"default-username"` DefaultRealname string `json:"default-realname"` }
UserInfo stores information about the user in our database
type UserPermissions ¶
type UserPermissions []string
UserPermissions is a list of permissions the user has access to
Click to show internal directories.
Click to hide internal directories.