Compare commits

..

24 Commits

Author SHA1 Message Date
016ae2a7b3 update description 2024-05-29 14:12:18 +02:00
2fff5eec4b update tsconfig 2024-04-14 17:26:24 +02:00
3aa4678053 update npmextra.json: githost 2024-04-01 21:34:18 +02:00
1344695d46 update npmextra.json: githost 2024-04-01 19:57:54 +02:00
0b2f66e0fd update npmextra.json: githost 2024-03-30 21:46:51 +01:00
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
788d74edeb 1.0.9 2019-10-02 19:20:00 +02:00
22 changed files with 6308 additions and 1798 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
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -4,35 +4,46 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
before_script:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ====================
# security stage
# ====================
mirror:
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci git mirror
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags:
- lossless
- docker
- notpriv
allow_failure: true
snyk:
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -41,26 +52,22 @@ snyk:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- priv
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
@ -70,6 +77,7 @@ release:
only:
- tags
tags:
- lossless
- docker
- notpriv
@ -79,12 +87,14 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
@ -95,20 +105,18 @@ trigger:
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:stable-dind
stage: metadata
script:
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command tsdoc
- npmci command npm run buildDocs
tags:
- lossless
- docker
- notpriv
only:

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"args": [
"${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"
"type": "node-terminal"
}
]
}

View File

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

View File

@ -1,17 +1,32 @@
{
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartcrypto",
"shortDescription": "easy crypto methods",
"npmPackagename": "@pushrocks/smartcrypto",
"description": "A library providing easy methods for cryptographic operations, including key pair generation.",
"npmPackagename": "@push.rocks/smartcrypto",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"cryptography",
"encryption",
"security",
"public key",
"private key",
"RSA",
"key pair generation",
"node-forge",
"typescript"
]
}
},
"npmci": {
"npmGlobalTools": [],
"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"
}
}

1637
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +1,59 @@
{
"name": "@pushrocks/smartcrypto",
"version": "1.0.8",
"name": "@push.rocks/smartcrypto",
"version": "2.0.5",
"private": false,
"description": "easy crypto methods",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"description": "A library providing easy methods for cryptographic operations, including key pair generation.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)",
"format": "(gitzone format)"
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.8",
"tslint": "^5.20.0",
"tslint-config-prettier": "^1.18.0"
"@git.zone/tsbuild": "^2.1.72",
"@git.zone/tsrun": "^1.2.46",
"@git.zone/tstest": "^1.0.86",
"@push.rocks/tapbundle": "^5.0.15",
"@types/node": "^20.11.17"
},
"dependencies": {
"@pushrocks/smartpromise": "^3.0.5",
"@types/node-forge": "^0.8.6",
"node-forge": "^0.9.1"
"@push.rocks/smartpromise": "^4.0.3",
"@types/node-forge": "^1.3.11",
"node-forge": "^1.3.1"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
]
],
"browserslist": [
"last 1 chrome versions"
],
"type": "module",
"keywords": [
"cryptography",
"encryption",
"security",
"public key",
"private key",
"RSA",
"key pair generation",
"node-forge",
"typescript"
],
"homepage": "https://code.foss.global/push.rocks/smartcrypto",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartcrypto.git"
}
}

5832
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

114
readme.md
View File

@ -1,26 +1,102 @@
# @pushrocks/smartcrypto
# @push.rocks/smartcrypto
easy crypto methods
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartcrypto)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartcrypto)
* [github.com (source mirror)](https://github.com/pushrocks/smartcrypto)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartcrypto/)
## 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)
[![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)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Install
To install `@push.rocks/smartcrypto`, open a terminal and run the following command:
```bash
npm install @push.rocks/smartcrypto
```
This will add `@push.rocks/smartcrypto` to your project's dependencies.
## Usage
This guide demonstrates how to use `@push.rocks/smartcrypto` effectively by covering its main functionalities. The module offers straightforward methods for handling cryptographic operations. We'll go through generating keys, encrypting and decrypting data, and converting keys to various formats.
For further information read the linked docs at the top of this readme.
### Setting up your project
Firstly, ensure you have a TypeScript project configured to use ES Modules. Initialize `@push.rocks/smartcrypto` in your project as shown:
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
```typescript
import { Smartcrypto } from '@push.rocks/smartcrypto';
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
const smartCrypto = new Smartcrypto();
```
### Generating a Key Pair
Generating a new RSA key pair is a common requirement. Let's see how `@push.rocks/smartcrypto` simplifies this process:
```typescript
(async () => {
const keyPair = await smartCrypto.createKeyPair();
console.log('Public Key:', keyPair.publicKey.toPemString());
console.log('Private Key:', keyPair.privateKey.toPemString());
})();
```
This asynchronous function generates a new RSA key pair and logs the PEM-formatted public and private keys. This is particularly useful for creating keys for secure communication.
### Working with Public and Private Keys
You can manipulate public and private keys using their respective classes. For instance, converting a private key to a PEM string for storage or transmission is straightforward:
```typescript
import { PrivateKey } from '@push.rocks/smartcrypto';
// Assuming you already have a privateKey object:
const privateKeyPemString = privateKey.toPemString();
console.log(privateKeyPemString);
```
Similarly, you can create a `PrivateKey` object from a PEM string. This is useful when you retrieve a stored key and need to use it in your application:
```typescript
const privateKeyFromPem = PrivateKey.fromPemString(privateKeyPemString);
```
The same methods apply to public keys with the `PublicKey` class:
```typescript
import { PublicKey } from '@push.rocks/smartcrypto';
const publicKeyPemString = publicKey.toPemString();
console.log(publicKeyPemString);
const publicKeyFromPem = PublicKey.fromPemString(publicKeyPemString);
```
### Advanced Usage
Beyond basic key generation and format conversion, `@push.rocks/smartcrypto` leverages `node-forge` for advanced cryptographic operations. You can engage in more complex scenarios such as signing data, verifying signatures, and even using the library for SSH key generation.
```typescript
// Example: Signing a message with RSA private key
const message = 'Hello, SmartCrypto!';
const signedMessage = privateKey.signMessage(message);
console.log('Signed Message:', signedMessage);
// Example: Verifying a signature with the corresponding public key
const isVerified = publicKey.verifyMessage(message, signedMessage);
console.log('Is the message verified?', isVerified);
```
Note: The `.signMessage` and `.verifyMessage` methods are conceptual and may require specific implementation or extension of the base classes provided by `@push.rocks/smartcrypto`.
### Conclusion
`@push.rocks/smartcrypto` provides an easy-to-use interface for cryptographic operations, significantly reducing the complexity of managing keys and performing secure data transmission. The examples above showcase a subset of what's possible, encouraging you to explore further and integrate cryptography seamlessly into your Node.js applications.
For more advanced use cases and customization, refer to the [node-forge](https://github.com/digitalbazaar/forge) documentation. `@push.rocks/smartcrypto` is designed to work smoothly with `node-forge`, enabling you to extend its functionalities according to your project's 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,8 +1,16 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartcrypto from '../ts/index';
import { expect, tap } from '@push.rocks/tapbundle';
import * as smartcrypto from '../ts/index.js';
let testSmartCrypto: smartcrypto.Smartcrypto;
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();

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.keypair';
export * from './smartcrypto.classes.privatekey';
export * from './smartcrypto.classes.publickey';
export * from './smartcrypto.classes.smartcrypto.js';
export * from './smartcrypto.classes.keypair.js';
export * from './smartcrypto.classes.privatekey.js';
export * from './smartcrypto.classes.publickey.js';
import { nodeForge } from './smartcrypto.plugins';
import { nodeForge } from './smartcrypto.plugins.js';
export {
nodeForge
};
export { nodeForge };

View File

@ -1,6 +1,6 @@
import * as plugins from './smartcrypto.plugins';
import { PublicKey } from './smartcrypto.classes.publickey';
import { PrivateKey } from './smartcrypto.classes.privatekey';
import * as plugins from './smartcrypto.plugins.js';
import { PublicKey } from './smartcrypto.classes.publickey.js';
import { PrivateKey } from './smartcrypto.classes.privatekey.js';
export class KeyPair {
// STATIC
@ -16,7 +16,7 @@ export class KeyPair {
done.resolve(
new KeyPair({
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 {
// STATIC
@ -21,4 +21,8 @@ export class PrivateKey {
public toPemString(): string {
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 {
// STATIC
@ -21,4 +21,8 @@ export class PublicKey {
public toPemString(): string {
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 { KeyPair } from './smartcrypto.classes.keypair';
import * as plugins from './smartcrypto.plugins.js';
import { KeyPair } from './smartcrypto.classes.keypair.js';
export class Smartcrypto {
public async createKeyPair(): Promise<KeyPair> {

View File

@ -1,9 +1,9 @@
// @pushrocks scope
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartpromise from '@push.rocks/smartpromise';
export { smartpromise };
// third party scope
import * as nodeForge from 'node-forge';
import nodeForge from 'node-forge';
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"
}