Constructor
new SmartInvoice(instanceConfig, userIdentity) → {object}
Parameters:
Name | Type | Description |
---|---|---|
instanceConfig |
Object | Json object with configuration for new instance |
userIdentity |
Identity | Sovrin identity object generate with createIdentity() |
Returns:
SmartInvoice - The top level SmartInvoice object
- Type
- object
Members
host
Set/Get host for SmartInvoice API
Host is used only for calls which does not required JWT
For authenticated calls the host is taken by interceptor from JWT
jwt
Set/Get Json Web Token which is used to authenticate against endpoint from host variable
Methods
(static) createIdentity() → {Object}
Generate new DID base identity
It include public and private key. Currently supported only Sovrin but in the feature
this would be extended to other DID Methods.
Currently supported confguration:
{
host, // host of the api endpoint to which you want to connect
invitationCode //invitation code required to connect to pilot network
}
Returns:
object including public and private key for the identity.
- Type
- Object
(async) decryptTransactionPayload(senderDID, encryptedPayload) → {Object}
Decrypt payload from transaction
Parameters:
Name | Type | Description |
---|---|---|
senderDID |
String | Sender DID |
encryptedPayload |
String | encrypted payload from transaction |
Returns:
decrypted payload
- Type
- Object
fetchDocuments(startTimestamp, endTimestamp)
Allow to fetch document for the user within given time frame.
Parameters:
Name | Type | Description |
---|---|---|
startTimestamp |
Timestamp | Miliseconds since 1900, from when we should get documents |
endTimestamp |
Timestamp | Miliseconds since 1900, until when we should look for documents |
(async) forwardDocument(receiverDID, dri, payload)
Forward existing document on the network to given receiver
Parameters:
Name | Type | Description |
---|---|---|
receiverDID |
String | Decentralize identifier of the receiver |
dri |
String | Decentralize Resource Identifier of the forwarding file |
payload |
Object | Additional information which should be attached to the document |
(async) login() → {Promise}
Login user and get JWT token for next calls
Returns:
axios promise and if success Json Web Token (JWT)
- Type
- Promise
(async) sendTo(receiverDID, file, payload)
Send document via SmartInvoice platform to the receiver
Parameters:
Name | Type | Description |
---|---|---|
receiverDID |
String | Decentralize identifier of the receiver |
file |
File | Document which should be sent |
payload |
Object | Additional information which should be attached to the document |