18 Commits

Author SHA1 Message Date
6e53d69194 2.0.5 2024-02-09 17:53:20 +01:00
5129377992 fix(core): update 2024-02-09 17:53:20 +01:00
316470fd97 2.0.4 2024-02-09 17:53:09 +01:00
6c464b047d fix(core): update 2024-02-09 17:53:08 +01:00
73df372f70 2.0.3 2024-02-09 17:52:14 +01:00
2aedc2232b fix(core): update 2024-02-09 17:52:13 +01:00
515257ff48 2.0.2 2023-08-21 08:29:28 +02:00
52ca7c298b fix(core): update 2023-08-21 08:29:27 +02:00
4e88c65901 switch to new org scheme 2023-07-11 00:28:48 +02:00
ac84ec9327 switch to new org scheme 2023-07-10 02:42:50 +02:00
038f7e2e9f 2.0.1 2022-10-24 07:06:14 +02:00
f3fca605a4 fix(core): update 2022-10-24 07:06:13 +02:00
0d3a8dde59 2.0.0 2022-10-23 23:53:34 +02:00
548c8147e6 BREAKING CHANGE(core): switch to esm 2022-10-23 23:53:34 +02:00
cf6d1b2b04 1.0.11 2021-02-20 17:52:21 +00:00
214677b3c4 fix(core): update 2021-02-20 17:52:21 +00:00
0f0cfdae77 1.0.10 2021-02-20 17:51:31 +00:00
ca381efaec fix(core): update 2021-02-20 17:51:30 +00:00
21 changed files with 6206 additions and 1790 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds # builds
dist/ dist/
dist_web/ dist_*/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -3,36 +3,47 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
before_script:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
mirror: # ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci git mirror - npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags: tags:
- docker - lossless
- notpriv - docker
allow_failure: true
snyk: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm install -g snyk - npmci command pnpm audit --audit-level=high --dev
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags: tags:
- docker - lossless
- notpriv - docker
allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -41,37 +52,34 @@ snyk:
testStable: testStable:
stage: test stage: test
script: script:
- npmci npm prepare - npmci node install stable
- npmci node install stable - npmci npm install
- npmci npm install - npmci npm test
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci node install stable
- npmci node install stable - npmci npm install
- npmci npm install - npmci command npm run build
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install stable - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# metadata stage # metadata stage
@ -79,36 +87,36 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g typescript
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- docker - lossless
- priv - docker
- priv
trigger: trigger:
stage: metadata stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:stable-dind
stage: metadata stage: metadata
script: script:
- npmci command npm install -g @gitzone/tsdoc - npmci node install stable
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command npm run buildDocs
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:
@ -116,5 +124,5 @@ pages:
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true allow_failure: true

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "current file", "command": "npm test",
"type": "node", "name": "Run npm test",
"request": "launch", "request": "launch",
"args": [ "type": "node-terminal"
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
} }
] ]
} }

View File

@ -11,7 +11,13 @@
}, },
"gitzone": { "gitzone": {
"type": "object", "type": "object",
"description": "settings for gitzone" "description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
} }
} }
} }

View File

@ -1,11 +1,12 @@
{ {
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "push.rocks",
"gitrepo": "smartcrypto", "gitrepo": "smartcrypto",
"shortDescription": "easy crypto methods", "description": "easy crypto methods",
"npmPackagename": "@pushrocks/smartcrypto", "npmPackagename": "@push.rocks/smartcrypto",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks"
} }

1637
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +1,43 @@
{ {
"name": "@pushrocks/smartcrypto", "name": "@push.rocks/smartcrypto",
"version": "1.0.9", "version": "2.0.5",
"private": false, "private": false,
"description": "easy crypto methods", "description": "easy crypto methods",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/ --web)",
"build": "(tsbuild)", "build": "(tsbuild --web)",
"format": "(gitzone format)" "buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.17", "@git.zone/tsbuild": "^2.1.72",
"@gitzone/tstest": "^1.0.24", "@git.zone/tsrun": "^1.2.46",
"@pushrocks/tapbundle": "^3.0.13", "@git.zone/tstest": "^1.0.86",
"@types/node": "^12.7.8", "@push.rocks/tapbundle": "^5.0.15",
"tslint": "^5.20.0", "@types/node": "^20.11.17"
"tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartpromise": "^3.0.5", "@push.rocks/smartpromise": "^4.0.3",
"@types/node-forge": "^0.8.6", "@types/node-forge": "^1.3.11",
"node-forge": "^0.9.1" "node-forge": "^1.3.1"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_*/**/*",
"dist_ts_web/*", "dist_ts/**/*",
"assets/*", "dist_ts_web/**/*",
"assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
] ],
"browserslist": [
"last 1 chrome versions"
],
"type": "module"
} }

5832
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,39 @@
# @pushrocks/smartcrypto # @push.rocks/smartcrypto
easy crypto methods easy crypto methods
## Availabililty and Links ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartcrypto) * [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartcrypto)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartcrypto) * [gitlab.com (source)](https://gitlab.com/push.rocks/smartcrypto)
* [github.com (source mirror)](https://github.com/pushrocks/smartcrypto) * [github.com (source mirror)](https://github.com/push.rocks/smartcrypto)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartcrypto/) * [docs (typedoc)](https://push.rocks.gitlab.io/smartcrypto/)
## Status for master ## Status for master
[![build status](https://gitlab.com/pushrocks/smartcrypto/badges/master/build.svg)](https://gitlab.com/pushrocks/smartcrypto/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartcrypto/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartcrypto/commits/master) Status Category | Status Badge
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartcrypto.svg)](https://www.npmjs.com/package/@pushrocks/smartcrypto) -- | --
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartcrypto/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartcrypto) GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartcrypto/badges/master/pipeline.svg)](https://lossless.cloud)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartcrypto/badges/master/coverage.svg)](https://lossless.cloud)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartcrypto)](https://lossless.cloud)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartcrypto)](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/@push.rocks/smartcrypto)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartcrypto)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartcrypto)](https://lossless.cloud)
## Usage ## Usage
## Contribution
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). :)
## Contribution
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). :)
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) ## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,8 +1,16 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@push.rocks/tapbundle';
import * as smartcrypto from '../ts/index'; import * as smartcrypto from '../ts/index.js';
let testSmartCrypto: smartcrypto.Smartcrypto;
tap.test('first test', async () => { tap.test('first test', async () => {
console.log('hi'); testSmartCrypto = new smartcrypto.Smartcrypto();
expect(testSmartCrypto).toBeInstanceOf(smartcrypto.Smartcrypto);
});
tap.test('should create a private public keypair', async () => {
const keypair = await testSmartCrypto.createKeyPair();
console.log(keypair);
}); });
tap.start(); tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartcrypto',
version: '2.0.5',
description: 'easy crypto methods'
}

View File

@ -1,10 +1,8 @@
export * from './smartcrypto.classes.smartcrypto'; export * from './smartcrypto.classes.smartcrypto.js';
export * from './smartcrypto.classes.keypair'; export * from './smartcrypto.classes.keypair.js';
export * from './smartcrypto.classes.privatekey'; export * from './smartcrypto.classes.privatekey.js';
export * from './smartcrypto.classes.publickey'; export * from './smartcrypto.classes.publickey.js';
import { nodeForge } from './smartcrypto.plugins'; import { nodeForge } from './smartcrypto.plugins.js';
export { export { nodeForge };
nodeForge
};

View File

@ -1,6 +1,6 @@
import * as plugins from './smartcrypto.plugins'; import * as plugins from './smartcrypto.plugins.js';
import { PublicKey } from './smartcrypto.classes.publickey'; import { PublicKey } from './smartcrypto.classes.publickey.js';
import { PrivateKey } from './smartcrypto.classes.privatekey'; import { PrivateKey } from './smartcrypto.classes.privatekey.js';
export class KeyPair { export class KeyPair {
// STATIC // STATIC
@ -16,7 +16,7 @@ export class KeyPair {
done.resolve( done.resolve(
new KeyPair({ new KeyPair({
privateKey: new PrivateKey(keypair.privateKey), privateKey: new PrivateKey(keypair.privateKey),
publicKey: new PublicKey(keypair.publicKey) publicKey: new PublicKey(keypair.publicKey),
}) })
); );
}); });

View File

@ -1,4 +1,4 @@
import * as plugins from './smartcrypto.plugins'; import * as plugins from './smartcrypto.plugins.js';
export class PrivateKey { export class PrivateKey {
// STATIC // STATIC
@ -21,4 +21,8 @@ export class PrivateKey {
public toPemString(): string { public toPemString(): string {
return plugins.nodeForge.pki.privateKeyToPem(this.forgePrivateKey); return plugins.nodeForge.pki.privateKeyToPem(this.forgePrivateKey);
} }
public toOpenSSH(): string {
return plugins.nodeForge.ssh.privateKeyToOpenSSH(this.forgePrivateKey, 'user@host');
}
} }

View File

@ -1,4 +1,4 @@
import * as plugins from './smartcrypto.plugins'; import * as plugins from './smartcrypto.plugins.js';
export class PublicKey { export class PublicKey {
// STATIC // STATIC
@ -21,4 +21,8 @@ export class PublicKey {
public toPemString(): string { public toPemString(): string {
return plugins.nodeForge.pki.publicKeyToPem(this.forgePublicKey); return plugins.nodeForge.pki.publicKeyToPem(this.forgePublicKey);
} }
public toOpenSSH(): string {
return plugins.nodeForge.ssh.publicKeyToOpenSSH(this.forgePublicKey, 'user@host');
}
} }

View File

@ -1,5 +1,5 @@
import * as plugins from './smartcrypto.plugins'; import * as plugins from './smartcrypto.plugins.js';
import { KeyPair } from './smartcrypto.classes.keypair'; import { KeyPair } from './smartcrypto.classes.keypair.js';
export class Smartcrypto { export class Smartcrypto {
public async createKeyPair(): Promise<KeyPair> { public async createKeyPair(): Promise<KeyPair> {

View File

@ -1,9 +1,9 @@
// @pushrocks scope // @pushrocks scope
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@push.rocks/smartpromise';
export { smartpromise }; export { smartpromise };
// third party scope // third party scope
import * as nodeForge from 'node-forge'; import nodeForge from 'node-forge';
export { nodeForge }; export { nodeForge };

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}