@hapiness/crypto

Crypto module provides some functions for security features like AES key, Key pair, RSA key, PKCS12, Certificate, PEM and more


Keywords
Crypto, RSA, PEM, PrivateKey, PublicKey, Certificate, RandomString, AES, PKCS12, KeyPair, JWT, Hapiness, Framework, NodeJS, Node, HTTP, API, REST, Streams, Async, Decorator, RxJS, Rx, ReactiveX, Observable, Observer, Module, ES2015, ES2016, ES2017, ES6, ES7, ES8, Typescript
License
NTP
Install
npm install @hapiness/crypto@1.0.0-rc.7

Documentation

Hapiness

Crypto Module

Crypto module for the Hapiness framework provides some functions for security features like AES key, Key pair, PKCS12, RSA key, Certificate, JWT and more.

We use existing node modules to provide these functions: NodeRSA, PEM, JWT and RandomString but we add Observable feature for asynchronous and stream processes.

All most important crypto features in only one module.

Table of contents

Using http module inside Hapiness application

yarn or npm it in your package.json

$ npm install --save @hapiness/core @hapiness/crypto rxjs

or

$ yarn add @hapiness/core @hapiness/crypto rxjs
"dependencies": {
    "@hapiness/core": "^1.0.0-rc.7",
    "@hapiness/crypto": "^1.0.0-rc.7",
    "rxjs": "^5.4.3",
    //...
}
//...

import CryptoModule

import { HapinessModule } from '@hapiness/core';
import { CryptoModule } from '@hapiness/crypto';

@HapinessModule({
    version: '1.0.0',
    declarations: [
        LibWithCrypto
    ],
    imports: [
        CryptoModule
    ]
})
class HapinessModuleNeedsCryptoModule {}

use it anywhere

You can use AESService, HashService, PEMService, RandomstringService, JWTService and RSAService anywhere in your module with dependency injection.

import { Lib } from '@hapiness/core';
import { RSAService, NodeRSA } from '@hapiness/crypto';

@Lib()
class LibWithCrypto {
    constructor(private _rsaService: RSAService) {}
    
    createRsaKey(): void {
        this._rsaService.createKey().subscribe(
            (k: NodeRSA) => console.log(k), // Show NodeRSA instance in console
            e => console.error(e) // Show error in console
        );
    }
}

Back to top

API in Detail

We implemented some services and to see their details go to documentation folder:

Back to top

Contributing

To set up your development environment:

  1. clone the repo to your workspace,
  2. in the shell cd to the main folder,
  3. hit npm or yarn install,
  4. run npm or yarn run test.
    • It will lint the code and execute all tests.
    • The test coverage report can be viewed from ./coverage/lcov-report/index.html.

Back to top

Change History

  • v1.0.0-rc.7 (2017-09-26)
    • Implementation of PemService.checkPkcs12() and PemService.checkCertificate().
    • Fix all operators related to latest rxjs version.
    • Related tests.
    • Latest packages' versions.
    • Documentation.
    • Module version related to core version.
  • v1.0.0-rc.6.2 (2017-08-02)
    • Implementation of JWTService
    • Related tests.
    • Documentation.
  • v1.0.0-rc.6 (2017-07-28)
    • Implementation of CryptoModule with AESService, HashService, PEMService, RandomstringService and RSAService
    • Implementation of Observable's operators for AESService and RSAService features.
    • Related tests.
    • Documentation.
    • Module version related to core version.

Maintainers

tadaweb
Julien Fauville Antoine Gomez Sébastien Ritz Nicolas Jessel

License

Copyright (c) 2017 Hapiness Licensed under the MIT license.

Back to top