@hapiness/crypto v1.0.1
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
- API in Detail
- Contributing
- Change History
- Maintainers
- License
Using http module inside Hapiness application
yarn or npm it in your package.json
$ npm install --save @hapiness/core @hapiness/crypto@next rxjs
or
$ yarn add @hapiness/core @hapiness/crypto@next rxjs"dependencies": {
"@hapiness/core": "^2.0.0-alpha",
"@hapiness/crypto": "^2.0.0-alpha",
"rxjs": "^6.5.2",
//...
}
//...import CryptoModule
import { Module } from '@hapiness/core';
import { CryptoModule } from '@hapiness/crypto';
@Module({
version: '1.0.0',
components: [
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
);
}
}API in Detail
We implemented some services and to see their details go to documentation folder:
- ./documentation/AESService.md
- ./documentation/HashService.md
- ./documentation/JWTService.md
- ./documentation/PEMService.md
- ./documentation/RandomstringService.md
- ./documentation/RSAService.md
Contributing
To set up your development environment:
- clone the repo to your workspace,
- in the shell
cdto the main folder, - hit
npm or yarn install, - 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.
Change History
- v2.0.0-alpha (2019-05-24)
- Migrate all features to
rxjsv6+. - Integration of
Hapinessv2-alpha based onfastify. - Related tests.
- Documentation.
- Migrate all features to
- v1.0.1 (2018-11-15)
- Fix of
cipher.final()inAESService.encryptWithAesKey()andAESService.decryptWithAesKey()operators
- Fix of
- v1.0.0 (2017-12-19)
- Implementation of
CryptoModulewithAESService,HashService,PEMService,RandomstringServiceandRSAService - Implementation of
Observable'soperators forAESServiceandRSAServicefeatures. - Implementation of
Lettable operatorsforAESServiceandRSAServicefeatures. - Related tests.
- Documentation.
- Implementation of
Maintainers
License
Copyright (c) 2019 Hapiness Licensed under the MIT license.
6 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago