Skip to content

Python script to manage Sony DPT-RP1 without Digital Paper App

Notifications You must be signed in to change notification settings

farhaven/dpt-rp1-py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dpt-rp1-py

Python script to manage Sony DPT-RP1 without Digital Paper App

Extracting the Private Key and ClientID

First, download the Digital Paper App. I am going to use the macOS version here but the process should be similar on Windows as the Digital Paper App is just an Electron wrapper around some JavaScript code. You will need to manipulate the application to extract the client identifier (client_id) and the certificate that the application receives from the device upon pairing.

The main application logic resides in a file called app.asar, which can be found at /Applications/Digital Paper App.app/Contents/Resources/app.asar after the installation. Extract this archive to a folder called dpt on your desktop using the asar command line utility, which can be installed using homebrew and npm.

brew install npm
npm install --global asar
cd "/Applications/Digital Paper App.app/Contents/Resources"
asar e app.asar ~/Desktop/dpt 

Surprisingly, the application is nicely organised into different modules that even come with source code comments and readme files. Those modules can be found in node_modules/mw-* within the dpt folder. To extract the client_id and the certificate to handle communication with the DPT-RP1, make just one change in /node_modules/mw-auth-ctrl/authctrl.js by adding a few statements after line 189:

// console.log('attempt to put /auth');
// console.log(JSON.stringify(authInfo, null, "  "));
var fs = require('fs');
var os = require('os');
var certPath = os.homedir() + '/Desktop/key.pem';
var clientPath = os.homedir() + '/Desktop/client_id.txt';
fs.writeFileSync(certPath, data, 'utf-8');
fs.writeFileSync(clientPath, deviceId, 'utf-8');
console.log(data);
console.log(deviceId);

Then use the asar utility again to archive the changes and implement them into the Digital Paper App.

cd "/Applications/Digital Paper App.app"
sudo asar p ~/Desktop/dpt ./Contents/Resources/app.asar

Now run the Digital Paper App and it will create two files, client_id.txt and key.pem, on the desktop once the pairing is complete.

About

Python script to manage Sony DPT-RP1 without Digital Paper App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%