Documentation
¶
Index ¶
- Constants
- Variables
- func CheckUser(ctx context.Context, usr *User, spk keyup.SignPublicKey, req Requestor) error
- func FindMessage(body string) (string, error)
- func GenerateStatement(sc *keyup.Sigchain, usr *User, sk *keyup.SignKey) (*keyup.Statement, error)
- func SetLogger(l Logger)
- func Sign(key keyup.Key, usr *User) (string, error)
- func Trim(msg string) (string, error)
- func ValidateStatement(st *keyup.Statement) error
- type Cache
- func (c *Cache) Expired(ctx context.Context, dt time.Duration) ([]keyup.ID, error)
- func (c *Cache) Get(ctx context.Context, kid keyup.ID) ([]*User, error)
- func (c *Cache) Search(ctx context.Context, req *SearchRequest) (*SearchResult, error)
- func (c *Cache) SetNowFn(nowFn func() time.Time)
- func (c *Cache) SetRequestor(req Requestor)
- func (c *Cache) Update(ctx context.Context, kid keyup.ID) error
- type ContextLogger
- type ErrHTTP
- type ErrTemporary
- type ErrTimeout
- type LogLevel
- type Logger
- type Requestor
- type SearchRequest
- type SearchResult
- type User
- func Check(ctx context.Context, sc *keyup.Sigchain, req Requestor, nowFn func() time.Time) ([]*User, error)
- func FindInSigchain(sc *keyup.Sigchain) ([]*User, error)
- func NewUser(kid keyup.ID, service string, name string, rawurl string, seq int) (*User, error)
- func NewUserForSigning(kid keyup.ID, service string, name string) (*User, error)
- func Verify(msg string, spk keyup.SignPublicKey, usr *User) (*User, error)
Constants ¶
const End = "END KEYUP MESSAGE."
End of a signed message
const Start = "BEGIN KEYUP MESSAGE."
Start of a signed message
Variables ¶
var ErrUserAlreadySet = errors.New("user set in sigchain already")
ErrUserAlreadySet is user already set in sigchain.
Functions ¶
func FindMessage ¶
FindMessage finds a message in HTML data
func GenerateStatement ¶
GenerateStatement for a user to add to the sigchain.
func ValidateStatement ¶
ValidateStatement returns error if statement is not a valid user statement.
Types ¶
type Cache ¶
Cache user information.
func NewCache ¶
func NewCache(dst keyup.Datastore, scs keyup.SigchainStore) *Cache
NewCache creates a Cache.
func (*Cache) Search ¶
func (c *Cache) Search(ctx context.Context, req *SearchRequest) (*SearchResult, error)
Search for users.
func (*Cache) SetRequestor ¶
SetRequestor sets the request implementation. For example, on google cloud this would use urlfetch.
type ContextLogger ¶
type ContextLogger interface { Debugf(ctx context.Context, format string, args ...interface{}) Infof(ctx context.Context, format string, args ...interface{}) Warningf(ctx context.Context, format string, args ...interface{}) Errorf(ctx context.Context, format string, args ...interface{}) }
ContextLogger interface used in this package with request context.
type ErrTemporary ¶
type ErrTemporary struct {
// contains filtered or unexported fields
}
ErrTemporary means there was a temporary error
func NewErrTemporary ¶
func NewErrTemporary(msg string) ErrTemporary
NewErrTemporary creates temporary error
func (ErrTemporary) Error ¶
func (e ErrTemporary) Error() string
type ErrTimeout ¶
type ErrTimeout struct {
// contains filtered or unexported fields
}
ErrTimeout is a timeout error
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
Logger interface used in this package.
type SearchRequest ¶
SearchRequest ...
type User ¶
User is a statement about a user on a service with a signed statement at a URL.
func Check ¶
func Check(ctx context.Context, sc *keyup.Sigchain, req Requestor, nowFn func() time.Time) ([]*User, error)
Check returns verified user statements URL in sigchain.
func FindInSigchain ¶
FindInSigchain user statements in the sigchain.
func NewUserForSigning ¶
NewUserForSigning returns User for signing (doesn't have remote URL yet).
func Verify ¶
Verify armored message for a user. If usr is specified, we will verify it matches the User in the verified message.
func (User) MarshalJSON ¶
MarshalJSON marshals user to JSON.
func (*User) UnmarshalJSON ¶
UnmarshalJSON unmarshals a user from JSON.