Compare commits

..

No commits in common. "master" and "v2.0.1" have entirely different histories.

12 changed files with 3081 additions and 5427 deletions

View File

@ -120,7 +120,7 @@ pages:
stage: metadata stage: metadata
script: script:
- npmci node install lts - npmci node install lts
- npmci command npm install -g @git.zone/tsdoc - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc

4
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"args": [ "args": [
"${relativeFile}" "${relativeFile}"
], ],
"runtimeArgs": ["-r", "@git.zone/tsrun"], "runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"protocol": "inspector", "protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart" "internalConsoleOptions": "openOnSessionStart"
@ -20,7 +20,7 @@
"args": [ "args": [
"test/test.ts" "test/test.ts"
], ],
"runtimeArgs": ["-r", "@git.zone/tsrun"], "runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"protocol": "inspector", "protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart" "internalConsoleOptions": "openOnSessionStart"

View File

@ -2,30 +2,17 @@
"gitzone": { "gitzone": {
"projectType": "npm", "projectType": "npm",
"module": { "module": {
"githost": "code.foss.global", "githost": "gitlab.com",
"gitscope": "push.rocks", "gitscope": "pushrocks",
"gitrepo": "isohash", "gitrepo": "isohash",
"description": "A cross-environment hash package supporting both browser and Node.js environments.", "description": "a hash package that works cross environment",
"npmPackagename": "@push.rocks/isohash", "npmPackagename": "@pushrocks/isohash",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks", "projectDomain": "push.rocks"
"keywords": [
"hashing",
"crypto",
"cross-environment",
"security",
"SHA-256",
"TypeScript",
"browser",
"Node.js"
]
} }
}, },
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
},
"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"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"name": "@push.rocks/isohash", "name": "@pushrocks/isohash",
"version": "2.0.2", "version": "2.0.1",
"private": false, "private": false,
"description": "A cross-environment hash package supporting both browser and Node.js environments.", "description": "a hash package that works cross environment",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module", "type": "module",
@ -13,15 +13,15 @@
"build": "(tsbuild --web)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.66", "@gitzone/tsbuild": "^2.1.65",
"@git.zone/tsrun": "^1.2.44", "@gitzone/tsrun": "^1.2.39",
"@git.zone/tstest": "^1.0.77", "@gitzone/tstest": "^1.0.74",
"@push.rocks/tapbundle": "^5.0.8", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^20.12.12" "@types/node": "^18.15.11"
}, },
"dependencies": { "dependencies": {
"@push.rocks/smartenv": "^5.0.5", "@pushrocks/smartenv": "^5.0.5",
"@push.rocks/smarthash": "^3.0.2" "@pushrocks/smarthash": "^3.0.2"
}, },
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
@ -37,20 +37,5 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
], ]
"keywords": [ }
"hashing",
"crypto",
"cross-environment",
"security",
"SHA-256",
"TypeScript",
"browser",
"Node.js"
],
"homepage": "https://code.foss.global/push.rocks/isohash",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/isohash.git"
}
}

8305
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@

108
readme.md
View File

@ -1,93 +1,39 @@
# @push.rocks/isohash # @pushrocks/isohash
a hash package that works cross environment a hash package that works cross environment
## Install ## 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/)
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 for master
```bash Status Category | Status Badge
npm install @push.rocks/isohash --save -- | --
``` 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)
This will add `@push.rocks/isohash` as a dependency to your `package.json` file and download the package to the `node_modules` folder. 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)
## Usage ## Usage
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. Use TypeScript for best in class intellisense
### Computing SHA-256 Hash ## Contribution
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. 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). :)
#### TypeScript Example For further information read the linked docs at the top of this readme.
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. > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
First, ensure you have TypeScript and the necessary types installed in your project. [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
```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.

View File

@ -1,4 +1,4 @@
import { expect, tap } from '@push.rocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as isohash from '../ts/index.js'; import * as isohash from '../ts/index.js';
tap.test('first test', async () => { tap.test('first test', async () => {
@ -9,4 +9,4 @@ tap.test('first test', async () => {
console.log(hashResult); console.log(hashResult);
}); });
export default tap.start(); tap.start();

View File

@ -2,7 +2,7 @@
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @pushrocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/isohash', name: '@pushrocks/isohash',
version: '2.0.2', version: '2.0.1',
description: 'A cross-environment hash package supporting both browser and Node.js environments.' description: 'a hash package that works cross environment'
} }

View File

@ -30,7 +30,7 @@ export const sha256FromString = async (stringArg: string): Promise<string> => {
const result = hex(hash); const result = hex(hash);
return result; return result;
} else if (smartenv.isNode) { } else if (smartenv.isNode) {
const smarthashModule: typeof import('@push.rocks/smarthash') = await smartenv.getSafeNodeModule('@push.rocks/smarthash'); const smarthashModule: typeof import('@pushrocks/smarthash') = await smartenv.getSafeNodeModule('@pushrocks/smarthash');
const result = await smarthashModule.sha256FromString(stringArg); const result = await smarthashModule.sha256FromString(stringArg);
return result; return result;
} }

View File

@ -1,5 +1,5 @@
// pushrocks scope // pushrocks scope
import * as smartenv from '@push.rocks/smartenv'; import * as smartenv from '@pushrocks/smartenv';
export { export {
smartenv smartenv

View File

@ -3,12 +3,8 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "useDefineForClassFields": false,
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "ES2022",
"moduleResolution": "NodeNext", "moduleResolution": "nodenext",
"esModuleInterop": true, "esModuleInterop": true
"verbatimModuleSyntax": true }
},
"exclude": [
"dist_*/**/*.d.ts"
]
} }