fix(core): update
This commit is contained in:
20
ts/smartcrypto.classes.privatekey.ts
Normal file
20
ts/smartcrypto.classes.privatekey.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as plugins from './smartcrypto.plugins';
|
||||
|
||||
export class PrivateKey {
|
||||
// STATIC
|
||||
public static createFromPrivateKey(pemString: string) {
|
||||
const privateKey = plugins.nodeForge.pki.privateKeyFromPem(pemString);
|
||||
return new PrivateKey(privateKey);
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
public forgePrivateKey: plugins.nodeForge.pki.PrivateKey;
|
||||
|
||||
constructor(privateKeyArg: plugins.nodeForge.pki.PrivateKey) {
|
||||
this.forgePrivateKey = privateKeyArg;
|
||||
}
|
||||
|
||||
public toPemString(): string {
|
||||
return plugins.nodeForge.pki.privateKeyToPem(this.forgePrivateKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user