Skip to content

Commit

Permalink
chore: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Dec 14, 2024
1 parent fe05495 commit 0cb5ff0
Show file tree
Hide file tree
Showing 34 changed files with 165 additions and 233 deletions.
16 changes: 8 additions & 8 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
engines:
eslint:
enabled: true
fixme:
enabled: true
eslint:
enabled: true
fixme:
enabled: true
ratings:
paths:
- "**.js"
- "**.jsx"
paths:
- "**.js"
- "**.jsx"
exclude_paths:
- test/**/*
- test/**/*
46 changes: 22 additions & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier'
],
plugins: [
'@typescript-eslint',
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-constant-condition": "off"
},
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"prettier",
],
plugins: ["@typescript-eslint"],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-constant-condition": "off",
},
};
24 changes: 12 additions & 12 deletions .fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

version: 2
cli:
server: https://app.fossa.com
fetcher: custom
project: https://github.com/node-opcua/node-opcua-crypto
server: https://app.fossa.com
fetcher: custom
project: https://github.com/node-opcua/node-opcua-crypto
analyze:
modules:
- name: .
type: npm
target: .
path: .
- name: .
type: npm
target: .
path: .
modules:
- name: .
type: npm
target: .
path: .
- name: .
type: npm
target: .
path: .
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ module.exports = {
singleQuote: false,
printWidth: 132,
tabWidth: 4,
};
};
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@ NodeOPCUA Crypto is a powerful JavaScript module for handling security and crypt
[![Coverage Status](https://coveralls.io/repos/github/node-opcua/node-opcua-crypto/badge.svg?branch=master)](https://coveralls.io/github/node-opcua/node-opcua-crypto?branch=master)
[![install size](https://packagephobia.com/badge?p=node-opcua-crypto)](https://packagephobia.com/result?p=node-opcua-crypto)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto.svg?type=shield)](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto?ref=badge_shield)

<!-- [![Test Coverage](https://codeclimate.com/github/node-opcua/node-opcua-crypto/badges/coverage.svg)](https://codeclimate.com/github/node-opcua/node-opcua-crypto/coverage) -->

## Features

* a comprehensive set of cryptographic functionalities.
* supports both Node.js and browser environments.
* compatible with TypeScript for robust, type-safe coding.
* implements advanced security standards for OPCUA.
- a comprehensive set of cryptographic functionalities.
- supports both Node.js and browser environments.
- compatible with TypeScript for robust, type-safe coding.
- implements advanced security standards for OPCUA.

## Getting Started

To use NodeOPCUA Crypto in your project, follow these steps:

#### Installation

``` bash
```bash
npm install nodeopcua-crypto
```

### Usage

``` bash
```bash

import { generatePrivateKey, privateKeyToPEM, CertificatePurpose, createSelfSignedCertificate } from "./node-opcua-crypto.js";

Expand Down Expand Up @@ -64,20 +65,16 @@ demonstratePrivateKeyAndSelfSignedCertificateCreation();
Please refer to the examples directory for more specific use cases and comprehensive samples.
## Support
Sterfive provides this module free of charge, "as is," with the hope that it will be useful to you. However, any support requests, bug fixes, or enhancements are handled exclusively through our paid services. We believe strongly that independent open-source companies should be fairly compensated for their contributions to the community.
We highly recommend subscribing to our support program to ensure your requests are addressed and resolved. Please note that we only consider requests from members of our support program or sponsors.
### Getting professional support
NodeOPCUA Crypto is developed and maintained by sterfive.com.
To get professional support, consider subscribing to the node-opcua membership community:
[![Professional Support](https://img.shields.io/static/v1?style=for-the-badge&label=Professional&message=Support&labelColor=blue&color=green&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQ5MS41MiA0OTEuNTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ5MS41MiA0OTEuNTI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxnPg0KCQk8cGF0aCBkPSJNNDg3Ljk4OSwzODkuNzU1bC05My4xMDktOTIuOTc2Yy00LjgxMy00LjgwNi0xMi42NDItNC42NzQtMTcuMjczLDAuMzA3Yy03LjE0OCw3LjY4OS0xNC42NCwxNS41NTQtMjEuNzMsMjIuNjM0ICAgIGMtMC4yNzEsMC4y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nPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPC9zdmc+)](https://support.sterfive.com)
Expand All @@ -88,17 +85,17 @@ or contact [sterfive](https://www.sterfive.com) for dedicated consulting and mor
We appreciate contributions from the community. To contribute:
* Fork the repository.
* Create a new branch.
* Commit your changes.
* Submit a pull request.
* Sign the CLA (Contributor Licence Agreement) form
- Fork the repository.
- Create a new branch.
- Commit your changes.
- Submit a pull request.
- Sign the CLA (Contributor Licence Agreement) form
For more detailed instructions, refer to the CONTRIBUTING.md file.
## License
NodeOPCUA Crypto is MIT licensed. See the [LICENSE file](./LICENSE) for full license details.
NodeOPCUA Crypto is MIT licensed. See the [LICENSE file](./LICENSE) for full license details.
Copyright © 2023-2024 Sterfive.com.
Expand All @@ -110,9 +107,7 @@ Please report any issues or vulnerabilities you find via the issue tracker.
Thank you for considering NodeOPCUA Crypto for your OPCUA cryptography needs. We look forward to seeing what you build with i
## Supporting the development effort - Sponsors & Backers
## Supporting the development effort - Sponsors & Backers
If you like `node-opcua-crypto` and if you are relying on it in one of your projects, please consider becoming a backer and [sponsoring us](https://opencollective.com/node-opcua), this will help us to maintain a high-quality stack and constant evolution of this module.
Expand Down
8 changes: 4 additions & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "4.12.0",
"npmClient": "npm"
}
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "4.12.0",
"npmClient": "npm"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
"tsup": "^8.3.5",
"typescript": "^5.7.2"
}
}
}
7 changes: 2 additions & 5 deletions packages/node-opcua-crypto-test/.mocharc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"require": [
"../../node_modules/should",
"../../node_modules/source-map-support/register"
],
"require": ["../../node_modules/should", "../../node_modules/source-map-support/register"],
"extension": ["js"]
}
}
1 change: 0 additions & 1 deletion packages/node-opcua-crypto-test/test-cjs/test_cjs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { exploreCertificateInfo } = require("node-opcua-crypto");
// eslint-disable-next-line no-undef


try {
exploreCertificateInfo(Buffer.from("123"));
} catch (err) {
Expand Down
1 change: 0 additions & 1 deletion packages/node-opcua-crypto-test/test-esm/test_esm.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { exploreCertificateInfo } from "node-opcua-crypto/web";
// eslint-disable-next-line no-undef


try {
exploreCertificateInfo(Buffer.from("123"));
} catch (err) {
Expand Down
20 changes: 7 additions & 13 deletions packages/node-opcua-crypto-test/test/tslint.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"extends": "../tslint.json",
"rules": {
"no-console": [
false
],
"only-arrow-functions": [
false
],
"space-before-function-paren": [
false
]
}
}
"extends": "../tslint.json",
"rules": {
"no-console": [false],
"only-arrow-functions": [false],
"space-before-function-paren": [false]
}
}
2 changes: 1 addition & 1 deletion packages/node-opcua-crypto-test/test2/test-node20.11.1.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ const decryptedBuffer1 = privateDecrypt_long(encryptedBuffer1, bob_private_key,
const decryptedBuffer2 = privateDecrypt_long(encryptedBuffer2, bob_private_key, 256);

decryptedBuffer1.toString("hex").should.equal(decryptedBuffer2.toString("hex"));
console.log("decryptedBuffer1=", decryptedBuffer1.toString("utf-8"));
console.log("decryptedBuffer1=", decryptedBuffer1.toString("utf-8"));
6 changes: 2 additions & 4 deletions packages/node-opcua-crypto-test/toto.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as c from "node-opcua-crypto";


async function a(){
c.generateKeyPair(2048);

async function a() {
c.generateKeyPair(2048);
}
a();
1 change: 0 additions & 1 deletion packages/node-opcua-crypto-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
"extends": "./tsconfig.common.json",
"include": ["./test/*.ts", "./test/**/*.ts"]
}

3 changes: 1 addition & 2 deletions packages/node-opcua-crypto-web/bin/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ build({
polyfills: {
crypto: true,
constants: true,
}
},
}),
],
});


console.log("done");
70 changes: 35 additions & 35 deletions packages/node-opcua-crypto-web/package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"name": "node-opcua-crypto-web",
"private": true,
"version": "4.12.0",
"description": "Crypto tools for Node-OPCUA",
"scripts": {
"build:tsup": "tsup --config tsup.config.mjs --clean",
"build": "node bin/esbuild.mjs",
"tslint": "tslint --project . --fix",
"lint": "eslint . --ext .ts",
"prettier-format": "prettier --config .prettierrc.js source/**/*.ts test/**/*.ts --write",
"demo": "npx http-server ."
},
"keywords": [
"OPCUA",
"opcua",
"m2m",
"iot",
"opc ua",
"internet of things"
],
"author": "Etienne Rossignon",
"license": "MIT",
"engine": {
"node": ">=16.0"
},
"dependencies": {
"node-opcua-crypto": "^4.12.0"
},
"repository": {
"type": "git",
"url": "git://github.com/node-opcua/node-opcua-crypto.git"
},
"bugs": {
"url": "https://github.com/node-opcua/node-opcua-crypto/issues"
}
"name": "node-opcua-crypto-web",
"private": true,
"version": "4.12.0",
"description": "Crypto tools for Node-OPCUA",
"scripts": {
"build:tsup": "tsup --config tsup.config.mjs --clean",
"build": "node bin/esbuild.mjs",
"tslint": "tslint --project . --fix",
"lint": "eslint . --ext .ts",
"prettier-format": "prettier --config .prettierrc.js source/**/*.ts test/**/*.ts --write",
"demo": "npx http-server ."
},
"keywords": [
"OPCUA",
"opcua",
"m2m",
"iot",
"opc ua",
"internet of things"
],
"author": "Etienne Rossignon",
"license": "MIT",
"engine": {
"node": ">=16.0"
},
"dependencies": {
"node-opcua-crypto": "^4.12.0"
},
"repository": {
"type": "git",
"url": "git://github.com/node-opcua/node-opcua-crypto.git"
},
"bugs": {
"url": "https://github.com/node-opcua/node-opcua-crypto/issues"
}
}
8 changes: 4 additions & 4 deletions packages/node-opcua-crypto-web/tsup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineConfig } from 'tsup'
import { defineConfig } from "tsup";

export default defineConfig({
entry: ['web/main.ts'],
entry: ["web/main.ts"],
splitting: false,
sourcemap: true,
format: ['esm'],
format: ["esm"],
bundle: true,
clean: true,
})
});
Loading

0 comments on commit 0cb5ff0

Please sign in to comment.