0.2.20 • Published 4 years ago

@caelumlabs/sdk v0.2.20

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

Lorena SDK

Client library for interacting with Lorena identities

npm install @lorena-ssi/lorena-sdk

NPM Status Build Status Coverage Status

Usage

const Lorena = require('@lorena-ssi/lorena-sdk').default
// const import Lorena from '@lorena-ssi/lorena-sdk'
const main = async () => {
  const lorena = new Lorena({debug: true})
  lorena.connect('connectionIdString')

  lorena.on('error', (e) => {
    console.log(e)
  })

  lorena.on('ready', async () => {
    lorena.callRecipe({
      recipe: 'ping', // Remote recipe we are calling to
      recipeId: 0, // Remote id of the recipeId we are calling to
      threadRef: 'pong', // Local name for your process
      threadId: 2, // Local id  for your process
      payload: {} // Payload to send
    })

  })

  lorena.on('message:pong', (payload) => {
    console.log('pong', payload)
  })
}

main()

API

new Lorena([serverPath[,options]] || [options])

serverPath can be a valid matrix server string, default: https://matrix.caelumlabs.com

options include:

{
    debug: false // set the debug option, default false
}

createUser(username, password)

Create Matrix user and zenroom keypair. Returns true or false when success or not available. Throws an error and emits error if fails.

connect(connectionstring)

Connect to Lorena IDspace. connectionstring is a concatenation of username-password-did

Returns true if the connection is success

Throws an error and emits error if fails.

handshake()

Establishes a connection with the IDspace, checking public-key signatures.

on(message[:threadRef, :type], [function(payload)])

Listen to events and execute the callback function

threadRef is the one sended to sendAction

type TODO

payload is the data coming from the remote recipe

off(message[:threadRef, :type])

Stops listening for events

License

MIT

0.2.20

4 years ago

0.2.19

4 years ago

0.2.18

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.0

5 years ago

0.1.30

5 years ago

0.1.28

5 years ago

0.1.29

5 years ago

0.1.23

5 years ago

0.1.25

5 years ago

0.1.26

5 years ago

0.1.27

5 years ago

0.1.22

5 years ago

0.1.21

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.15

5 years ago

0.1.13

5 years ago

0.1.11

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.5

5 years ago