Skip to content

Commit

Permalink
docs: update readme and generate api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jul 12, 2019
1 parent 0470713 commit 87b7d62
Show file tree
Hide file tree
Showing 23 changed files with 4,929 additions and 17 deletions.
88 changes: 71 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,93 @@
<div align="center">
<img src="https://res.cloudinary.com/adonisjs/image/upload/q_100/v1557762307/poppinss_iftxlt.jpg" width="600px">
</div>

# Password hashing
> Module to hash values with support for [PHC string format](https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md)
[![circleci-image]][circleci-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

This module is used by [AdonisJs](https://adonisjs.com) to hash user password with first class support for upgrading logic. A big thanks to the author of [uphash](https://github.com/simonepri/upash), who inspired me to use [PHC string format](https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md). I would have used uphash directly, but the user facing API is different from what I desire.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of contents

- [@poppinss/hash](#poppinsshash)
- [Change log](#change-log)
- [Contributing](#contributing)
- [Authors & License](#authors--license)
- [Features](#features)
- [Usage](#usage)
- [Switching drivers](#switching-drivers)
- [Adding custom drivers](#adding-custom-drivers)
- [API Docs](#api-docs)
- [Maintainers](#maintainers)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# @poppinss/hash
## Features
1. Support for multiple hashing algorithms.
2. Option to extend and add your own hashing algorithms.
3. Wraps the hash output to a [PHC string format](https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md), this allows upgrading user passwords, when the underlying configuration changes.

## Usage
Install the package from npm registry as follows:

```sh
npm i @poppinss/hash

# yarn
yarn add @poppinss/hash
```

[![circleci-image]][circleci-url]
[![npm-image]][npm-url]
![](https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript)
and then use it as follows:

## Change log
```ts
import { Hash } from '@poppinss/hash'
const hash = new Hash(iocContainer, config)

The change log can be found in the [CHANGELOG.md](CHANGELOG.md) file.
const hashedValue = await hash.hash('password')
await hash.verify(hashedValue)

## Contributing
await hash.needsRehash(hashedValue) // false
```

Everyone is welcome to contribute. Please go through the following guides, before getting started.
## Switching drivers
You can switch drivers using the `driver` method.

1. [Contributing](https://adonisjs.com/contributing)
2. [Code of conduct](https://adonisjs.com/code-of-conduct)
```ts
import { Hash } from '@poppinss/hash'
const hash = new Hash(iocContainer, config)

await hash.driver('bcrypt').hash('password')
```

## Authors & License
[thetutlage](https://github.com/thetutlage) and [contributors](https://github.com/poppinss/hash/graphs/contributors).
## Adding custom drivers
The custom drivers can be added using the `extend` method.

MIT License, see the included [MIT](LICENSE.md) file.
```ts
import { Hash, HashDriverContract } from '@poppinss/hash'
const hash = new Hash(iocContainer, config)

class Scrypt implements HashDriverContract {}

hash.extend('scrypt', (container) => {
return new Scrypt()
})
```

## API Docs
Following are the autogenerated files via Typedoc

* [API](docs/README.md)

## Maintainers
[Harminder virk](https://github.com/thetutlage)

[circleci-image]: https://img.shields.io/circleci/project/github/poppinss/hash/master.svg?style=for-the-badge&logo=circleci
[circleci-url]: https://circleci.com/gh/poppinss/hash "circleci"

[npm-image]: https://img.shields.io/npm/v/@poppinss/hash.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@poppinss/hash "npm"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript

[license-url]: LICENSE.md
[license-image]: https://img.shields.io/aur/license/pac.svg?style=for-the-badge
865 changes: 865 additions & 0 deletions docs/assets/css/main.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/assets/css/main.css.map

Large diffs are not rendered by default.

Binary file added docs/assets/images/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/icons@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/widgets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/widgets@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/assets/js/main.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/assets/js/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 87b7d62

Please sign in to comment.