> For the complete documentation index, see [llms.txt](https://biot-ws.gitbook.io/biot-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://biot-ws.gitbook.io/biot-core/api/apps.md).

# Apps

BIoT Wallet have internal applications. With the help of this API you can develop your own applications.&#x20;

**Example:**

```javascript
const core = require('biot-core');
const eventBus = require('ocore/event_bus');

let timers = {};
let n = {};

(async () => {
	await core.init('test');
	eventBus.on('paired', (from_address) => {
		core.sendTechMessageToDevice(from_address, {type: 'imapp'});
	});

	eventBus.on('object', async (from_address, object) => {
		if (object.app === 'BIoT') {
			if (object.type === 'hello') {
				n[from_address] = 0;
				core.sendTechMessageToDevice(from_address, {
					type: 'render', page: 'start', form: [
						{type: 'h2', id: 'n', title: 0}
					]
				});
				timers[from_address] = setInterval(() => {
					n[from_address]++;
					core.sendTechMessageToDevice(from_address, {
						type: 'update', id: 'n', value: {type: 'h2', title: n[from_address], id: 'n'}
					});
				}, 1000);
			} else if (object.type === 'close') {
				console.error('close', from_address);
				clearInterval(timers[from_address]);
				delete timers[from_address];
				delete n[from_address];
			}
		}
	});
})().catch(console.error);	
```

### f.type === 'input'

Using to display the html block \<input>, using with title, id, required.

**Example:**

**`{type: 'input', title: 'Name', id: 'name', required: true}`**<br>

### f.type === 'address'

Creates a link, by clicking on which the address is going to be selected.\
\
**Example:**\
**`{type: 'address', required: true, title: 'Select wallet for address', id: 'address'}`**

### f.type === 'blank\_line'

Using to create a blank line by displaying the html block. \<div>\<br/>\</div><br>

### **f.type === 'submit'**

Using to create a button when clicking on which sends the completed data to the server.<br>

**Example:**

`{ type: 'render', page: 'index', form: [ {type: 'input', title: 'Name', id: 'name', required: true}, {type: 'input', title: 'Last Name', id: 'lname', required: true}, {type: 'input', title: 'Age', id: 'age', required: true}, {type: 'address', required: true, title: 'Select wallet for address', id: 'address'}, {type: 'blank_line'}, {type: 'submit', title: 'Send'} ] }`<br>

### **f.type === 'h2'**

Using to display the html block \<h2> \</h2>, where “title” is what you want to display.

**Example:**&#x20;

**`{type: 'h2', title: 'You attested'}`**<br>

### **f.type === 'h3'**

Using to display the html block \<h2> \</h2>, where “title” is what you want to display.

**Example:**&#x20;

**`{type: 'h3', title: 'Scan RFID to start'}`**<br>

### **f.type === 'text'**

Using to display text, where “title” is what you want to display.

**Example:**

**`{type: 'text',title: (openChannels[from_address].myAmount - 1) + '/1000 bytes',id: 'balanceChannel'}`**<br>

### **f.type === 'request'**

Using for sending small data.

**Example:**

**`{type: 'request', title: 'Close channel', req: 'close_channel'}`**<br>

### **f.type === 'list-menu'**

Using for sending small data.

**Example:**

**`{type: 'list-menu', title: 'Switch on red light', req: 'switch_red'}`**

### **object.type === 'render'**

Using to render the page. Required along with page and form.\
Where “page” is the name of the page and “form” is what needs to be displayed.

**Example:**

`{ type: 'render', page: 'attested', form: [ {type: 'h2', title: 'You attested'} ] }`<br>

### **object.type === 'addProfile'**

**Using to save profile data:**\
**my\_address -** address of attestor,\
**your\_address -** your addres,  \
**unit -** profile publication unit,\
**profile -** profile object

**Example:**

[**https://github.com/BIoTws/attestation-app/blob/master/index.js**](https://github.com/BIoTws/attestation-app/blob/master/index.js)

`{ type: 'addProfile', my_address: res.address, your_address: object.response.address, unit: res.objJoint.unit.unit, profile: res.src_profile }`\ <br>

### **object.type === 'alert'**

Using to display an error through alert. Where “message” is the error text.

**Example:**\
**`{type: 'alert', message: 'Error'}`**<br>

### **object.type === 'update'**

Using to update existing data.\
id - id of replacement data\
value - which element will be inserted there with the corresponding parameters

**Example:**

`{ type: 'update', id: 'balanceChannel', value: { type: 'text', title: (channel.myAmount - 1) + '/1000 bytes', id: 'balanceChannel' } }`\ <br>
