apilcp

package
v0.0.0-...-da9a50a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2021 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadHexValue = errors.New("Erroneous user_key.hex_value can't be decoded")

ErrBadHexValue sets an error message returned to the caller

View Source
var ErrBadValue = errors.New("Erroneous user_key.value, can't be decoded")

ErrBadValue sets an error message returned to the caller

View Source
var ErrMandatoryInfoMissing = errors.New("Mandatory info missing in the input body")

ErrMandatoryInfoMissing sets an error message returned to the caller

Functions

func AddContent

func AddContent(w http.ResponseWriter, r *http.Request, s Server)

AddContent adds content to the storage lcp spec : store data resulting from an external encryption PUT method with PAYLOAD : LcpPublication in json format This method adds the input encrypted file in a store and adds the corresponding decryption key to the database. The content_id is taken from the url. The input file is then deleted.

func DecodeJSONLicense

func DecodeJSONLicense(r *http.Request, lic *license.License) error

DecodeJSONLicense decodes a license formatted in json and returns a license object

func GenerateLicense

func GenerateLicense(w http.ResponseWriter, r *http.Request, s Server)

GenerateLicense generates and returns a new license, for a given content identified by its id plus a partial license given as input

func GenerateLicensedPublication

func GenerateLicensedPublication(w http.ResponseWriter, r *http.Request, s Server)

GenerateLicensedPublication generates and returns a licensed publication for a given content identified by its id plus a partial license given as input

func GetContent

func GetContent(w http.ResponseWriter, r *http.Request, s Server)

GetContent fetches and returns an encrypted content file selected by it content id (uuid)

func GetLicense

func GetLicense(w http.ResponseWriter, r *http.Request, s Server)

GetLicense returns an existing license, selected by a license id and a partial license both given as input. The input partial license is optional: if absent, a partial license is returned to the caller, with the info stored in the db.

func GetLicensedPublication

func GetLicensedPublication(w http.ResponseWriter, r *http.Request, s Server)

GetLicensedPublication returns a licensed publication for a given license identified by its id plus a partial license given as input

func ListContents

func ListContents(w http.ResponseWriter, r *http.Request, s Server)

ListContents lists the content in the storage index

func ListLicenses

func ListLicenses(w http.ResponseWriter, r *http.Request, s Server)

ListLicenses returns a JSON struct with information about the existing licenses parameters:

page: page number
per_page: number of items par page

func ListLicensesForContent

func ListLicensesForContent(w http.ResponseWriter, r *http.Request, s Server)

ListLicensesForContent lists all licenses associated with a given content parameters:

content_id: content identifier
page: page number (default 1)
per_page: number of items par page (default 30)

func StoreContent

func StoreContent(w http.ResponseWriter, r *http.Request, s Server)

StoreContent stores content in the storage. The content name is given in the url (name) A temporary file is created, then deleted after the content has been stored

func UpdateLicense

func UpdateLicense(w http.ResponseWriter, r *http.Request, s Server)

UpdateLicense updates an existing license. parameters:

{license_id} in the calling URL
partial license containing properties which should be updated (and only these)

return: an http status code (200, 400 or 404) Usually called from the License Status Server after a renew, return or cancel/revoke action -> updates the end date.

Types

type LcpPublication

type LcpPublication struct {
	ContentID          string  `json:"content-id"`
	ContentKey         []byte  `json:"content-encryption-key"`
	Output             string  `json:"protected-content-location"`
	Size               *int64  `json:"protected-content-length"`
	Checksum           *string `json:"protected-content-sha256"`
	ContentDisposition *string `json:"protected-content-disposition"`
	ContentType        string  `json:"protected-content-type,omitempty"`
	ErrorMessage       string  `json:"error,omitempty"`
}

LcpPublication is a struct for communication with lcp-server

type Server

type Server interface {
	Store() storage.Store
	Index() index.Index
	Licenses() license.Store
	Certificate() *tls.Certificate
	Source() *pack.ManualSource
}

Server groups functions used by the lcp server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL