@blockr/blockr-crypto

Small library for cryptography operations.

Usage no npm install needed!

<script type="module">
  import blockrBlockrCrypto from 'https://cdn.skypack.dev/@blockr/blockr-crypto';
</script>

README

blockr-crypto

small library for cryptography operations

CI SonarQube Version
Build Status Quality Gate Status npm

The utilities exposed by this library can be consumed either by dependency injection or normal construction.

Importing

ES6

import { ObjectHasher } from "@blockr/blockr-crypto";

ES5

const ObjectHasher = require("@blockr/blockr-crypto");

Dependency injection

This library uses inversify-js as its dependency injection library. This means the consuming project is required to do the same.

Example:

This example uses the ObjectHasher util.

container

DIContainer.bind<ObjectHasher>(ObjectHasher).toSelf().inTransientScope();

consumer (typically a service)

class MainService {
    private objectHasher: ObjectHasher;

    constructor(@inject(ObjectHasher) objectHasher: ObjectHasher) {
        this.objectHasher = objectHasher;
    }
}

Normal construction

Example:

consumer (typically a service)

class MainService {
    private objectHasher: ObjectHasher;

    constructor() {
        this.objectHasher = new ObjectHasher();
    }
}