Documentation ¶
Index ¶
- Constants
- Variables
- func AddContent(w http.ResponseWriter, r *http.Request, s Server)
- func DecodeJSONLicense(r *http.Request, lic *license.License) error
- func DeleteContent(w http.ResponseWriter, r *http.Request, s Server)
- func GenerateLicense(w http.ResponseWriter, r *http.Request, s Server)
- func GenerateProtectedPublication(w http.ResponseWriter, r *http.Request, s Server)
- func GetContent(w http.ResponseWriter, r *http.Request, s Server)
- func GetLicense(w http.ResponseWriter, r *http.Request, s Server)
- func GetProtectedPublication(w http.ResponseWriter, r *http.Request, s Server)
- func GetTestLicense(w http.ResponseWriter, r *http.Request, s Server)
- func ListContents(w http.ResponseWriter, r *http.Request, s Server)
- func ListLicenses(w http.ResponseWriter, r *http.Request, s Server)
- func ListLicensesForContent(w http.ResponseWriter, r *http.Request, s Server)
- func StoreContent(w http.ResponseWriter, r *http.Request, s Server)
- func UpdateLicense(w http.ResponseWriter, r *http.Request, s Server)
- type Encrypted
- type Server
Constants ¶
const ( Storage_none = 0 Storage_s3 = 1 Storage_fs = 2 )
Variables ¶
var ErrBadHexValue = errors.New("erroneous user_key.hex_value can't be decoded")
ErrBadHexValue sets an error message returned to the caller
var ErrBadValue = errors.New("erroneous user_key.value, can't be decoded")
ErrBadValue sets an error message returned to the caller
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 : encrypted publication in json format This method adds an encrypted file to 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 ¶
DecodeJSONLicense decodes a license formatted in json and returns a license object
func DeleteContent ¶
func DeleteContent(w http.ResponseWriter, r *http.Request, s Server)
DeleteContent deletes a record
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 GenerateProtectedPublication ¶
func GenerateProtectedPublication(w http.ResponseWriter, r *http.Request, s Server)
GenerateProtectedPublication generates and returns a protected 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) This should be called only if the License Server stores the file. If it is not the case, the file should be fetched from a standard web server
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. If the input partial license is absent a partial license is returned
func GetProtectedPublication ¶
func GetProtectedPublication(w http.ResponseWriter, r *http.Request, s Server)
GetProtectedPublication returns a protected publication for a given license identified by its id plus a partial license given as input
func GetTestLicense ¶
func GetTestLicense(w http.ResponseWriter, r *http.Request, s Server)
GetTestLicense returns an existing license, selected by a license id and a partial license set to the last information generated on this server. This is only for test.
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 passed through the request body into the storage. The content name is given in the url (name) A temporary file is created, then deleted after the content has been stored. This function is using an async task.
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 Encrypted ¶
type Encrypted struct { ContentID string `json:"content-id"` ContentKey []byte `json:"content-encryption-key"` StorageMode int `json:"storage-mode"` Output string `json:"protected-content-location"` FileName string `json:"protected-content-disposition"` Size int64 `json:"protected-content-length"` Checksum string `json:"protected-content-sha256"` ContentType string `json:"protected-content-type,omitempty"` }
Encrypted is used for communication with the License Server