Documentation ¶
Index ¶
- Variables
- func CreateDefaultLinks()
- func EncryptLicenseFields(l *License, c index.Content) error
- func GenerateUserKey(key UserKey) []byte
- func Initialize(contentID string, l *License)
- func SetLicenseLinks(l *License, c index.Content) error
- func SetLicenseProfile(l *License)
- func SignLicense(l *License, cert *tls.Certificate) error
- type ContentKey
- type Encryption
- type EncryptionProfile
- type Key
- type License
- type LicenseReport
- type Link
- type Store
- type UserInfo
- type UserKey
- type UserRights
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLinks map[string]string
View Source
var ErrNotFound = errors.New("License not found")
Functions ¶
func CreateDefaultLinks ¶
func CreateDefaultLinks()
CreateDefaultLinks inits the global var DefaultLinks from config data
func EncryptLicenseFields ¶
EncryptLicenseFields sets the content key, encrypted user info and key check
func GenerateUserKey ¶
GenerateUserKey function prepares the user key
func Initialize ¶
Initialize sets a license id and issued date, contentID,
func SetLicenseLinks ¶
SetLicenseLinks sets publication and status links l.ContentID must have been set before the call
func SetLicenseProfile ¶
func SetLicenseProfile(l *License)
SetLicenseProfile sets the license profile from config
func SignLicense ¶
func SignLicense(l *License, cert *tls.Certificate) error
SignLicense signs a license using the server certificate
Types ¶
type ContentKey ¶
type Encryption ¶
type Encryption struct { Profile string `json:"profile,omitempty"` ContentKey ContentKey `json:"content_key"` UserKey UserKey `json:"user_key"` }
type EncryptionProfile ¶
type EncryptionProfile int
EncryptionProfile is an enum of possible encryption profiles
const ( BasicProfile EncryptionProfile = iota V1Profile )
Declare typed constants for Encryption Profile
func (EncryptionProfile) String ¶
func (profile EncryptionProfile) String() string
type License ¶
type License struct { Provider string `json:"provider"` ID string `json:"id"` Issued time.Time `json:"issued"` Updated *time.Time `json:"updated,omitempty"` Encryption Encryption `json:"encryption"` Links []Link `json:"links,omitempty"` User UserInfo `json:"user"` Rights *UserRights `json:"rights,omitempty"` Signature *sign.Signature `json:"signature,omitempty"` ContentID string `json:"-"` }
type LicenseReport ¶
type Link ¶
type Link struct { Rel string `json:"rel"` Href string `json:"href"` Type string `json:"type,omitempty"` Title string `json:"title,omitempty"` Profile string `json:"profile,omitempty"` Templated bool `json:"templated,omitempty"` Size int64 `json:"length,omitempty"` //Digest []byte `json:"hash,omitempty"` Checksum string `json:"hash,omitempty"` }
type Store ¶
type Store interface { //List() func() (License, error) List(ContentID string, page int, pageNum int) func() (LicenseReport, error) ListAll(page int, pageNum int) func() (LicenseReport, error) UpdateRights(l License) error Update(l License) error UpdateLsdStatus(id string, status int32) error Add(l License) error Get(id string) (License, error) }
Click to show internal directories.
Click to hide internal directories.