1.0.0-1 • Published 5 years ago

@blockr/blockr-crypto v1.0.0-1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

blockr-crypto

small library for cryptography operations

CISonarQubeVersion
Build StatusQuality Gate Statusnpm

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();
    }
}