@caelumlabs/comms

Lorena Communication Protocol

Usage no npm install needed!

<script type="module">
  import caelumlabsComms from 'https://cdn.skypack.dev/@caelumlabs/comms';
</script>

README

matrix-lib

matrix-lib is a caelum api for matrix connection used in Lorena SSI.

NPM Status Build Status Coverage Status

Installation

npm @lorena-ssi/matrix-lib

Getting Started

const Comms = require('@caelumlabs/comms')
// Creating class Matrix with parameter `homeserver`
const matrix = new Comms('https://matrix.org')
// Check if user exists
if ( (await matrix.available(username)) ) {
    // Registering to matrix `homeserver` with `username` and `password`
    const primaryUser = await matrix.register('username', 'password')
    // Connecting to account with username `username` and password `password`
    matrix.connect(username, password)
        .then((res)=>{console.log("Connected:", res)})
        .catch((e)=>{console.log("Error:", e)})
    // Read events: If argument=='' then all history events are received
    matrix.events('')
        .then((a,b)=>{console.log("Correct:", a)})
        .catch((e)=>{console.log("Error in events:", e)})
}