We offer a JavaScript helper library as an example of how to access and consume the API REST service from a JavaScript application. The library wraps the encryption resp. decryption process and the handling of the low level API. The deftlr.com page utilizes the same low level API, so every entry created using the library is instantly accessible from the website and vice versa (including entries created with libraries for another programming language). The JavaScript library is a module that should be instanciated with a constructor call, that accepts three parameters:
// your API key var clientVerificationToken = 'ABC123XYZ'; // the API (custom) base url var url = 'https://deftlr.com/api/'; // the secret to use for all requests using the current object var token = 'secret'; var deftlrCryptoLibrary = new DeftlrCryptoLibrary(clientVerificationToken, url, token);
Currently four methods are available, all with the same signature (with one small exception):
searchTag(tag, doneCallback, failCallback)
check if the specified tag existsreadMessage(tag, doneCallback, failCallback)
retrieve the decrypted content for the specified tagcreateMessage(tag, message, doneCallback, failCallback)
create new entry for the specified tagdeleteMessage(tag, doneCallback, failCallback)
delete the entry for the specified tagSearch for a specified tag and handle the result example:
deftlrCryptoLibrary.searchTag('hello', // doneCallback handler function(result, error) { if (!error) { console.log(result); } else { console.log(error); } }, // failCallback handler function (generalError) { console.log(generalError); });
Download the JavaScript DeftlrCryptoLibrary here.
We are currently working on:
listTags
find all tags belonging to the specified master tagreadFile
retrieve an entry containing file info and offer the file to the usercreateFile
create an entry from a file contentFind out more about the API here: API documentation