fix(core): update
This commit is contained in:
parent
73df372f70
commit
6c464b047d
6
dist_ts/index.d.ts
vendored
6
dist_ts/index.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
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.js';
|
|
||||||
export { nodeForge };
|
|
@ -1,7 +0,0 @@
|
|||||||
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.js';
|
|
||||||
export { nodeForge };
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyxxQ0FBcUMsQ0FBQztBQUNwRCxjQUFjLG9DQUFvQyxDQUFDO0FBRW5ELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUVyRCxPQUFPLEVBQUUsU0FBUyxFQUFFLENBQUMifQ==
|
|
11
dist_ts/smartcrypto.classes.keypair.d.ts
vendored
11
dist_ts/smartcrypto.classes.keypair.d.ts
vendored
@ -1,11 +0,0 @@
|
|||||||
import { PublicKey } from './smartcrypto.classes.publickey.js';
|
|
||||||
import { PrivateKey } from './smartcrypto.classes.privatekey.js';
|
|
||||||
export declare class KeyPair {
|
|
||||||
static createNewKeyPair(): Promise<KeyPair>;
|
|
||||||
publicKey: PublicKey;
|
|
||||||
privateKey: PrivateKey;
|
|
||||||
constructor(optionsArg: {
|
|
||||||
privateKey: PrivateKey;
|
|
||||||
publicKey: PublicKey;
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
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
|
|
||||||
static async createNewKeyPair() {
|
|
||||||
const done = plugins.smartpromise.defer();
|
|
||||||
const rsa = plugins.nodeForge.pki.rsa;
|
|
||||||
rsa.generateKeyPair({ bits: 2048, workers: 2 }, async (err, keypair) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
done.resolve(new KeyPair({
|
|
||||||
privateKey: new PrivateKey(keypair.privateKey),
|
|
||||||
publicKey: new PublicKey(keypair.publicKey),
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
constructor(optionsArg) {
|
|
||||||
this.privateKey = optionsArg.privateKey;
|
|
||||||
this.publicKey = optionsArg.publicKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8uY2xhc3Nlcy5rZXlwYWlyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRjcnlwdG8uY2xhc3Nlcy5rZXlwYWlyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sMEJBQTBCLENBQUM7QUFDcEQsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQy9ELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBT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
dist_ts/smartcrypto.classes.privatekey.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
/// <reference types="node-forge" />
|
|
||||||
import * as plugins from './smartcrypto.plugins.js';
|
|
||||||
export declare class PrivateKey {
|
|
||||||
static createFromPrivateKey(pemString: string): PrivateKey;
|
|
||||||
static fromPemString(pemString: string): PrivateKey;
|
|
||||||
forgePrivateKey: plugins.nodeForge.pki.PrivateKey;
|
|
||||||
constructor(privateKeyArg: plugins.nodeForge.pki.PrivateKey);
|
|
||||||
toPemString(): string;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
import * as plugins from './smartcrypto.plugins.js';
|
|
||||||
export class PrivateKey {
|
|
||||||
// STATIC
|
|
||||||
static createFromPrivateKey(pemString) {
|
|
||||||
const privateKey = plugins.nodeForge.pki.privateKeyFromPem(pemString);
|
|
||||||
return new PrivateKey(privateKey);
|
|
||||||
}
|
|
||||||
static fromPemString(pemString) {
|
|
||||||
return new PrivateKey(plugins.nodeForge.pki.privateKeyFromPem(pemString));
|
|
||||||
}
|
|
||||||
constructor(privateKeyArg) {
|
|
||||||
this.forgePrivateKey = privateKeyArg;
|
|
||||||
}
|
|
||||||
toPemString() {
|
|
||||||
return plugins.nodeForge.pki.privateKeyToPem(this.forgePrivateKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8uY2xhc3Nlcy5wcml2YXRla2V5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRjcnlwdG8uY2xhc3Nlcy5wcml2YXRla2V5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sMEJBQTBCLENBQUM7QUFFcEQsTUFBTSxPQUFPLFVBQVU7SUFDckIsU0FBUztJQUNGLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQyxTQUFpQjtRQUNsRCxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztRQUN0RSxPQUFPLElBQUksVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3BDLENBQUM7SUFFTSxNQUFNLENBQUMsYUFBYSxDQUFDLFNBQWlCO1FBQzNDLE9BQU8sSUFBSSxVQUFVLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQztJQUM1RSxDQUFDO0lBS0QsWUFBWSxhQUErQztRQUN6RCxJQUFJLENBQUMsZUFBZSxHQUFHLGFBQWEsQ0FBQztJQUN2QyxDQUFDO0lBRU0sV0FBVztRQUNoQixPQUFPLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUM7SUFDckUsQ0FBQztDQUNGIn0=
|
|
9
dist_ts/smartcrypto.classes.publickey.d.ts
vendored
9
dist_ts/smartcrypto.classes.publickey.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
/// <reference types="node-forge" />
|
|
||||||
import * as plugins from './smartcrypto.plugins.js';
|
|
||||||
export declare class PublicKey {
|
|
||||||
static createFromPrivateKey(pemString: string): PublicKey;
|
|
||||||
static fromPemString(pemString: string): PublicKey;
|
|
||||||
forgePublicKey: plugins.nodeForge.pki.PublicKey;
|
|
||||||
constructor(publicKeyArg: plugins.nodeForge.pki.PublicKey);
|
|
||||||
toPemString(): string;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
import * as plugins from './smartcrypto.plugins.js';
|
|
||||||
export class PublicKey {
|
|
||||||
// STATIC
|
|
||||||
static createFromPrivateKey(pemString) {
|
|
||||||
const privateKey = plugins.nodeForge.pki.publicKeyFromPem(pemString);
|
|
||||||
return new PublicKey(privateKey);
|
|
||||||
}
|
|
||||||
static fromPemString(pemString) {
|
|
||||||
return new PublicKey(plugins.nodeForge.pki.publicKeyFromPem(pemString));
|
|
||||||
}
|
|
||||||
constructor(publicKeyArg) {
|
|
||||||
this.forgePublicKey = publicKeyArg;
|
|
||||||
}
|
|
||||||
toPemString() {
|
|
||||||
return plugins.nodeForge.pki.publicKeyToPem(this.forgePublicKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8uY2xhc3Nlcy5wdWJsaWNrZXkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGNyeXB0by5jbGFzc2VzLnB1YmxpY2tleS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLDBCQUEwQixDQUFDO0FBRXBELE1BQU0sT0FBTyxTQUFTO0lBQ3BCLFNBQVM7SUFDRixNQUFNLENBQUMsb0JBQW9CLENBQUMsU0FBaUI7UUFDbEQsTUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsZ0JBQWdCLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDckUsT0FBTyxJQUFJLFNBQVMsQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBRU0sTUFBTSxDQUFDLGFBQWEsQ0FBQyxTQUFpQjtRQUMzQyxPQUFPLElBQUksU0FBUyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLGdCQUFnQixDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7SUFDMUUsQ0FBQztJQUtELFlBQVksWUFBNkM7UUFDdkQsSUFBSSxDQUFDLGNBQWMsR0FBRyxZQUFZLENBQUM7SUFDckMsQ0FBQztJQUVNLFdBQVc7UUFDaEIsT0FBTyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBQ25FLENBQUM7Q0FDRiJ9
|
|
4
dist_ts/smartcrypto.classes.smartcrypto.d.ts
vendored
4
dist_ts/smartcrypto.classes.smartcrypto.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
import { KeyPair } from './smartcrypto.classes.keypair.js';
|
|
||||||
export declare class Smartcrypto {
|
|
||||||
createKeyPair(): Promise<KeyPair>;
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
import * as plugins from './smartcrypto.plugins.js';
|
|
||||||
import { KeyPair } from './smartcrypto.classes.keypair.js';
|
|
||||||
export class Smartcrypto {
|
|
||||||
async createKeyPair() {
|
|
||||||
return KeyPair.createNewKeyPair();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8uY2xhc3Nlcy5zbWFydGNyeXB0by5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y3J5cHRvLmNsYXNzZXMuc21hcnRjcnlwdG8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSwwQkFBMEIsQ0FBQztBQUNwRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFM0QsTUFBTSxPQUFPLFdBQVc7SUFDZixLQUFLLENBQUMsYUFBYTtRQUN4QixPQUFPLE9BQU8sQ0FBQyxnQkFBZ0IsRUFBRSxDQUFDO0lBQ3BDLENBQUM7Q0FDRiJ9
|
|
4
dist_ts/smartcrypto.plugins.d.ts
vendored
4
dist_ts/smartcrypto.plugins.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
import * as smartpromise from '@push.rocks/smartpromise';
|
|
||||||
export { smartpromise };
|
|
||||||
import nodeForge from 'node-forge';
|
|
||||||
export { nodeForge };
|
|
@ -1,7 +0,0 @@
|
|||||||
// @pushrocks scope
|
|
||||||
import * as smartpromise from '@push.rocks/smartpromise';
|
|
||||||
export { smartpromise };
|
|
||||||
// third party scope
|
|
||||||
import nodeForge from 'node-forge';
|
|
||||||
export { nodeForge };
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y3J5cHRvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsbUJBQW1CO0FBQ25CLE9BQU8sS0FBSyxZQUFZLE1BQU0sMEJBQTBCLENBQUM7QUFFekQsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBRXhCLG9CQUFvQjtBQUNwQixPQUFPLFNBQVMsTUFBTSxZQUFZLENBQUM7QUFFbkMsT0FBTyxFQUFFLFNBQVMsRUFBRSxDQUFDIn0=
|
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartcrypto',
|
name: '@push.rocks/smartcrypto',
|
||||||
version: '2.0.3',
|
version: '2.0.4',
|
||||||
description: 'easy crypto methods'
|
description: 'easy crypto methods'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user