diff --git a/npmextra.json b/npmextra.json index 024feb5..eefc5c4 100644 --- a/npmextra.json +++ b/npmextra.json @@ -5,17 +5,27 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "isohash", - "description": "a hash package that works cross environment", + "description": "A cross-environment hash package supporting both browser and Node.js environments.", "npmPackagename": "@push.rocks/isohash", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "keywords": [ + "hashing", + "crypto", + "cross-environment", + "security", + "SHA-256", + "TypeScript", + "browser", + "Node.js" + ] } }, "npmci": { "npmGlobalTools": [], "npmAccessLevel": "public" }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index e684c7c..f9a2566 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/isohash", "version": "2.0.1", "private": false, - "description": "a hash package that works cross environment", + "description": "A cross-environment hash package supporting both browser and Node.js environments.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -37,5 +37,15 @@ "cli.js", "npmextra.json", "readme.md" + ], + "keywords": [ + "hashing", + "crypto", + "cross-environment", + "security", + "SHA-256", + "TypeScript", + "browser", + "Node.js" ] } \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index b8bf814..515b2e7 100644 --- a/readme.md +++ b/readme.md @@ -1,39 +1,93 @@ -# @pushrocks/isohash +# @push.rocks/isohash a hash package that works cross environment -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/isohash) -* [gitlab.com (source)](https://gitlab.com/pushrocks/isohash) -* [github.com (source mirror)](https://github.com/pushrocks/isohash) -* [docs (typedoc)](https://pushrocks.gitlab.io/isohash/) +## Install -## Status for master +To start using @push.rocks/isohash in your project, you need to install it via npm. Ensure you have Node.js and npm installed on your system before proceeding. Then, run the following command in your project's root directory: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/isohash/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/isohash/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/isohash)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/isohash)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/isohash)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/isohash)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/isohash)](https://lossless.cloud) -Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud) +```bash +npm install @push.rocks/isohash --save +``` + +This will add `@push.rocks/isohash` as a dependency to your `package.json` file and download the package to the `node_modules` folder. ## Usage -Use TypeScript for best in class intellisense +This section provides detailed examples and explanations on how to use the `@push.rocks/isohash` package effectively in your projects. The package offers a seamless way to compute hash values, specifically SHA-256, in various environments such as Node.js and modern web browsers. -## Contribution +### Computing SHA-256 Hash -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +The primary feature of `@push.rocks/isohash` is computing SHA-256 hash values from strings. This process varies depending on the environment—Node.js or the browser. The package abstracts these differences, providing a unified API. -For further information read the linked docs at the top of this readme. +#### TypeScript Example -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +Below is a TypeScript example demonstrating how to compute a SHA-256 hash from a given string. This example is applicable regardless of your environment, thanks to the cross-environment capabilities of @push.rocks/isohash. -[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) +First, ensure you have TypeScript and the necessary types installed in your project. + +```bash +npm install typescript @types/node --save-dev +``` + +Then, you can compute a SHA-256 hash as follows: + +```typescript +import { sha256FromString } from '@push.rocks/isohash'; + +// Example string to hash +const exampleString = 'Hello, world!'; + +(async () => { + // Compute the SHA-256 hash of the example string + const hashResult = await sha256FromString(exampleString); + console.log(`SHA-256 Hash: ${hashResult}`); +})(); +``` + +This function asynchronously returns the SHA-256 hash of the input string in hexadecimal format. The package internally handles the computation differences between Node.js and browser environments, providing a consistent API. + +### Understanding Cross-Environment Hashing + +@push.rocks/isohash leverages different underlying technologies based on the execution environment: + +- **In Node.js**, it uses the `crypto` module available in the Node.js standard library to compute hashes. +- **In Browsers**, it utilizes the Web Crypto API (`crypto.subtle`). + +This design choice ensures that the library is lightweight and performs well in both environments by using the most efficient and secure methods available in each. + +### Real-World Use Cases + +Here are a few scenarios where computing hashes with @push.rocks/isohash can be beneficial: + +- Verifying the integrity of data transmitted over a network. +- Generating unique identifiers for data that can be compared efficiently. +- Implementing secure password storage mechanisms (when combined with salts). + +The cross-environment capability makes @push.rocks/isohash an excellent choice for applications that need to perform hashing operations both client-side and server-side, such as Single Page Applications (SPAs) with Node.js backends. + +### Contributions + +Contributing to the development of `@push.rocks/isohash` is encouraged. Whether you're improving the documentation, adding new features, or reporting bugs, your contributions are welcome. Visit the [repository](https://gitlab.com/pushrocks/isohash) to get started. + +### Wrapping Up + +In conclusion, `@push.rocks/isohash` offers a streamlined, environment-agnostic approach to computing SHA-256 hash values in TypeScript projects. By abstracting away the environmental differences, it enables developers to write cleaner, more maintainable code for both server-side and client-side hashing needs. + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.