Documentation ¶
Index ¶
- Variables
- func GenerateToken(addrHash hash.Hash, routingID string, validUntil time.Time, ...) string
- func SetDefaultRepository(r Repository)
- func VerifyInviteToken(token string, addrHash hash.Hash, routingID string, key bmcrypto.PubKey) bool
- type KeyStatus
- type Repository
- type ResolveInfoType
- type SqliteDbResolver
- func (r *SqliteDbResolver) Create(hash, routing string, publicKey *bmcrypto.PubKey, proof, redirHash string) (bool, error)
- func (r *SqliteDbResolver) Delete(hash string) (bool, error)
- func (r *SqliteDbResolver) Get(hash string) (*ResolveInfoType, error)
- func (r *SqliteDbResolver) GetKeyStatus(hash string, fingerprint string) (KeyStatus, error)
- func (r *SqliteDbResolver) SetKeyStatus(hash string, fingerprint string, status KeyStatus) error
- func (r *SqliteDbResolver) SoftDelete(hash string) (bool, error)
- func (r *SqliteDbResolver) SoftUndelete(hash string) (bool, error)
- func (r *SqliteDbResolver) Update(info *ResolveInfoType, routing string, publicKey *bmcrypto.PubKey, ...) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("record not found") ErrCannotUpdate = errors.New("cannot update record") )
Error codes
View Source
var TimeNow = time.Now
Functions ¶
func GenerateToken ¶
func SetDefaultRepository ¶
func SetDefaultRepository(r Repository)
Sets the default repository for resolving. Can be used to override for mocking/testing purposes
Types ¶
type Repository ¶
type Repository interface { // Retrieve from hash Get(hash string) (*ResolveInfoType, error) // Create a new entry Create(hash, routing string, publicKey *bmcrypto.PubKey, proof string, redirHash string) (bool, error) // Update an existing entry Update(info *ResolveInfoType, routing string, publicKey *bmcrypto.PubKey, redirHash string) (bool, error) // Softdelete an entry SoftDelete(hash string) (bool, error) // Undelete a softdeleted entry SoftUndelete(hash string) (bool, error) // Remove the entry completely (destructive) Delete(hash string) (bool, error) // Get the status of this (old) key GetKeyStatus(hash string, fingerprint string) (KeyStatus, error) // Set the given key status SetKeyStatus(hash string, fingerprint string, status KeyStatus) error }
Repository to resolve records
func GetResolveRepository ¶
func GetResolveRepository() Repository
GetResolveRepository returns a new repository based on DynamoDB
func NewBoltResolver ¶
func NewBoltResolver() Repository
NewBoltResolver returns a new resolver based on BoltDB
func NewDynamoDBResolver ¶
func NewDynamoDBResolver(client dynamodbiface.DynamoDBAPI, tableName, historyTableName string) Repository
NewDynamoDBResolver returns a new resolver based on DynamoDB
func NewSqliteResolver ¶
func NewSqliteResolver(dsn string) Repository
NewDynamoDBResolver returns a new resolver based on DynamoDB
type ResolveInfoType ¶
type ResolveInfoType struct { Hash string RedirHash string RoutingID string PubKey string Proof string Serial uint64 Deleted bool DeletedAt time.Time }
ResolveInfoType returns information found in the resolver repository
type SqliteDbResolver ¶
type SqliteDbResolver struct { TableName string TimeNow time.Time // contains filtered or unexported fields }
func (*SqliteDbResolver) Get ¶
func (r *SqliteDbResolver) Get(hash string) (*ResolveInfoType, error)
func (*SqliteDbResolver) GetKeyStatus ¶ added in v0.2.0
func (r *SqliteDbResolver) GetKeyStatus(hash string, fingerprint string) (KeyStatus, error)
func (*SqliteDbResolver) SetKeyStatus ¶ added in v0.2.0
func (r *SqliteDbResolver) SetKeyStatus(hash string, fingerprint string, status KeyStatus) error
func (*SqliteDbResolver) SoftDelete ¶ added in v0.2.0
func (r *SqliteDbResolver) SoftDelete(hash string) (bool, error)
func (*SqliteDbResolver) SoftUndelete ¶ added in v0.2.0
func (r *SqliteDbResolver) SoftUndelete(hash string) (bool, error)
func (*SqliteDbResolver) Update ¶
func (r *SqliteDbResolver) Update(info *ResolveInfoType, routing string, publicKey *bmcrypto.PubKey, redirHash string) (bool, error)
Click to show internal directories.
Click to hide internal directories.