0.9.0 • Published 5 years ago
lahdes-api v0.9.0
Lahdes NodeJs API package
Simplifies calls and communication with Lahdes API, thus providing an even easier way for the businesses to integrate Lahdes service in their existing framework.
Basic usage
Initialise the library with appropriate values
var Lahdes = require('Lahdes');
// ...
api = Lahdes({
clientId: 'client_id_provided_by_lahdes',
clientSecret: 'client_secret_provided_by_lahdes',
environment: 'production',
});
Variable | Required | Type | Description |
---|---|---|---|
clientId | Yes | String | Identification provided by Lahdes |
clientSecret | Yes | String | Identification provided by Lahdes |
environment | No | String | Defaults to production if not set explicitly |
Request public key for the user
Only thing necessary to initiate file delivery is recipients Personal Identification Number.
await api.requestPublicKey(serialNumber);
Variable | Required | Type | Description |
---|---|---|---|
serialNumber | Yes | String | User personal identification number in format PNOLV-000000-00000 |
Encrypt and send the file to the recipient
Relative path to the file must be provided, encryption is applied before the file is sent to the Lahdes. For additional assurance of recipient aknowledgment, phone number must be provided to which the notification will be sent, unless Lahdes database has more up-to-date contact information of the user.
await api.sendAndEncryptFile(file, fileName, options = {});
Variable | Required | Type | Description |
---|---|---|---|
file | Yes | String | Path to the file which should be encrypted and sent |
fileName | Yes | String | Desired filename to be used for the recipient |
options | No | Object | List of options to customise the Request |
Possible options which can be passed with request
Variable | Required | Type | Description |
---|---|---|---|
phoneNumber | No | String | Phone number in international format, ex. +37100000000 , defaults to phone number provided by recipient (if any) |
sendText | No | Boolean | Must be passed as true to perform the text message delivery, defaults to false |
0.9.0
5 years ago