Skip to content
Snippets Groups Projects
Commit 2863feb3 authored by Markin Igor's avatar Markin Igor
Browse files

Add usage examples

parent 6f0133fe
No related branches found
No related tags found
1 merge request!4Use webpack for bundling JS libs and move Golang code related to Iframe generation there
......@@ -3,6 +3,49 @@
Vereign’s JavaScript library is an asynchronous library that allows for digitally signing your email and in-browser documents, data encryption, and key-based authentication.
## Usage
Add library as inline script.
```html
<script type="text/javascript" src="./viamapi-client.js"/>
```
Initialize library
```js
// Target container used to append iframe
const containerId = "root";
// Required methods used to be called within iframe.
const methods = {
onEvent(event) { console.log(event) }
};
// Iframe URL to connect
const iframeUrl = "https://test.org/iframe";
// API url used to access endpoints
const apiUrl = "https://test.org/api";
this.library = setupViamAPI(containerId, methods, iframeUrl, apiUrl);
this.library.then(lib => {
this.listenerUUID = this.addListener({
callback: function(event) {
handleEvent(event);
},
filters: [
"IdentityNotLoaded",
"ActionConfirmedAndExecuted",
"Authenticated"
]
});
lib.listIdentities().then(response => {
this.setState({ identities: response.data });
});
});
```
## Development
### Running
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment