1.0.20 • Published 1 year ago

@owlnext/heimdall-js v1.0.20

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

heimdallJS

Heimdall API client & utils for javascript technologies.

Prerequisites

To use this client, you must first have an admin user on the Heimdall API.

Installation

npm -i --save @owlnext/heimdall-js

Usage

import Heimdall from '@owlnext/heimdall-js'

// first, authenticate your Heimdall client
const heimdall: Heimdall = new Heimdall();
heimdall.authenticate({
    login: '<your login>',
    password: '<your password>',
    application_uuid: '<your application UUID>'
});

// check if the client is authenticated
if(true === heimdall.isAuthenticated()) {
    // ...
}

// check the user connected
if('my_user_login' === heimdall.api.getCurrentLoggedIn()) {
    // ...
}

// encrypt a file with a new key
let encrypted: string;

heimdall.createKey(['<a group iri>']).then(key => {
    heimdall.getCipherKey(key.id).then(cipher => {
        encrypted = heimdall.encrypt('<your message>', cipher.cipherKey);
    });
});

// decrypt a file
let decrypted: string;

heimdall.getCipherKey('<key id>').then(cipher => {
    decrypted = heimdall.decrypt('<your encrypted message>', cipher.cipherKey);
});

Note: You also have access to the full API implementation with the api getter from the Heimdall object.

Integration environment

To use integration environment, simply add the server_environment as a property to your authentication.

import Heimdall from '@owlnext/heimdall-js'

// Authentication
const heimdall: Heimdall = new Heimdall();

heimdall.authenticate({
    login: '<your login>',
    password: '<your password>',
    application_uuid: '<your application UUID>',
    server_environment: Heimdall.SERVER_ENVIRONMENT_INTEGRATION
});

// Refresh
heimdall.reconnect({
    refresh_token: '<your refresh token>',
    application_uuid: '<your application UUID>',
    server_environment: Heimdall.SERVER_ENVIRONMENT_INTEGRATION
});

If left untouched, the default behaviour points the API to the production environment.

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.20

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.11

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago