-
Notifications
You must be signed in to change notification settings - Fork 57
Testing an LCP server using an LCP compliant app
Here is a How To
about testing an LCP server using an LCP compliant app like R2 Reader.
- Configure the LCP server
On my test platform, I'm storing the .yaml config file in a specific folder in my user space, which also contains the provider certificate and private key plus the htpasswd
file.
This folder is specified as the value of the READIUM_LCPSERVER_CONFIG
, READIUM_LCPSERVER_CONFIG
and READIUM_LCPSERVER_CONFIG
environment variables (on my test platform, all three executables are on the same machine; this may not a good choice in production, as the License Status server must be visible from the Web and the License server must not).
For testing purpose, the IP address set in the config file must be the WiFi address of your PC (e.g. 192.168.0.30). This opens the servers to requests coming from mobile devices connected to this WiFi connection.
- Start the LCP server
Usually, for testing purpose, I open a console with three tabs (I'm using a Mac with iTerm2). On each tab I cd $GOPATH
then launch one of the the 3 servers.
I then open a new tab in my browser and type the IP of the frontend server, e.g. http://192.168.0.30/8991
.
- Create a license
From the frontend UI, I can Add a publication
by choosing a file in the "master repository" (see config parameter frontend/master_repository
) or by dropping a file in the import area. Each file is given a name, i.e. the ebook title.
I can also Add a User
with his passphrase.
Then I can Add a Purchase
, which mimics what would happen on a real bookseller frontend. Once a purchase (i.e. a buy
or loan
action) is achieved, I can use the Status
panel corresponding to this purchase, hit the LCPL
button and load a .lcpl file to my PC.
I usually move this file to an iCloud folder (resp. Google Drive) if I want to load this .lcpl file with an iPhone (resp. Android device), but a Dropbox is equally useful, and you can even share such files as attachments of emails.
- Import the license into the device
From my device, I open R2 Reader (or any other LCP compliant app) and find the .lcpl file in the shared folder using the +
action. Some LCP compliant apps don't have an import feature, but you can use the 'Open With' or 'Share with' feature of the device, after selecting the .lcpl file, for importing it into the LCP compliant app.
The app should immediately download the encrypted content from your LCP server (via the http endpoint corresponding to the storage/filesystem/directory
config parameter). It should then request your passphrase if needed, then open the ebook.