Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
72a696908a | |||
f3d63e027f | |||
5192008320 | |||
6595d61562 | |||
9e6cb240dd | |||
03175e208a |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartcrypto",
|
"name": "@pushrocks/smartcrypto",
|
||||||
"version": "1.0.4",
|
"version": "1.0.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
15
package.json
15
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartcrypto",
|
"name": "@pushrocks/smartcrypto",
|
||||||
"version": "1.0.4",
|
"version": "1.0.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "easy crypto methods",
|
"description": "easy crypto methods",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -24,5 +24,16 @@
|
|||||||
"@pushrocks/smartpromise": "^3.0.5",
|
"@pushrocks/smartpromise": "^3.0.5",
|
||||||
"@types/node-forge": "^0.8.6",
|
"@types/node-forge": "^0.8.6",
|
||||||
"node-forge": "^0.9.1"
|
"node-forge": "^0.9.1"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/*",
|
||||||
|
"ts_web/*",
|
||||||
|
"dist/*",
|
||||||
|
"dist_web/*",
|
||||||
|
"dist_ts_web/*",
|
||||||
|
"assets/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
26
readme.md
Normal file
26
readme.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# @pushrocks/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
|
||||||
|
[](https://gitlab.com/pushrocks/smartcrypto/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/smartcrypto/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/@pushrocks/smartcrypto)
|
||||||
|
[](https://snyk.io/test/npm/@pushrocks/smartcrypto)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://prettier.io/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
@ -1 +1,4 @@
|
|||||||
export * from './smartcrypto.classes.smartcrypto';
|
export * from './smartcrypto.classes.smartcrypto';
|
||||||
|
export * from './smartcrypto.classes.keypair';
|
||||||
|
export * from './smartcrypto.classes.privatekey';
|
||||||
|
export * from './smartcrypto.classes.publickey';
|
||||||
|
@ -13,11 +13,12 @@ export class KeyPair {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
done.resolve(new KeyPair({
|
done.resolve(
|
||||||
|
new KeyPair({
|
||||||
privateKey: new PrivateKey(keypair.privateKey),
|
privateKey: new PrivateKey(keypair.privateKey),
|
||||||
publicKey: new PublicKey(keypair.publicKey),
|
publicKey: new PublicKey(keypair.publicKey)
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
@ -26,10 +27,7 @@ export class KeyPair {
|
|||||||
public publicKey: PublicKey;
|
public publicKey: PublicKey;
|
||||||
public privateKey: PrivateKey;
|
public privateKey: PrivateKey;
|
||||||
|
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: { privateKey: PrivateKey; publicKey: PublicKey }) {
|
||||||
privateKey: PrivateKey;
|
|
||||||
publicKey: PublicKey;
|
|
||||||
}) {
|
|
||||||
this.privateKey = optionsArg.privateKey;
|
this.privateKey = optionsArg.privateKey;
|
||||||
this.publicKey = optionsArg.publicKey;
|
this.publicKey = optionsArg.publicKey;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@ export class PrivateKey {
|
|||||||
return new PrivateKey(privateKey);
|
return new PrivateKey(privateKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static fromPemString(pemString: string) {
|
||||||
|
return new PrivateKey(plugins.nodeForge.pki.privateKeyFromPem(pemString));
|
||||||
|
}
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public forgePrivateKey: plugins.nodeForge.pki.PrivateKey;
|
public forgePrivateKey: plugins.nodeForge.pki.PrivateKey;
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@ export class PublicKey {
|
|||||||
return new PublicKey(privateKey);
|
return new PublicKey(privateKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static fromPemString(pemString: string) {
|
||||||
|
return new PublicKey(plugins.nodeForge.pki.publicKeyFromPem(pemString));
|
||||||
|
}
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public forgePublicKey: plugins.nodeForge.pki.PublicKey;
|
public forgePublicKey: plugins.nodeForge.pki.PublicKey;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import * as plugins from './smartcrypto.plugins';
|
import * as plugins from './smartcrypto.plugins';
|
||||||
|
import { KeyPair } from './smartcrypto.classes.keypair';
|
||||||
|
|
||||||
export class Smartcrypto {
|
export class Smartcrypto {
|
||||||
|
public async createKeyPair(): Promise<KeyPair> {
|
||||||
|
return KeyPair.createNewKeyPair();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,13 +1,9 @@
|
|||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
export {
|
export { smartpromise };
|
||||||
smartpromise
|
|
||||||
};
|
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import * as nodeForge from 'node-forge';
|
import * as nodeForge from 'node-forge';
|
||||||
|
|
||||||
export {
|
export { nodeForge };
|
||||||
nodeForge
|
|
||||||
};
|
|
||||||
|
Reference in New Issue
Block a user