2023-08-21 06:29:27 +00:00
|
|
|
import * as plugins from './smartcrypto.plugins.js';
|
|
|
|
export class PrivateKey {
|
2021-02-20 17:51:30 +00:00
|
|
|
// 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));
|
|
|
|
}
|
2023-08-21 06:29:27 +00:00
|
|
|
constructor(privateKeyArg) {
|
|
|
|
this.forgePrivateKey = privateKeyArg;
|
|
|
|
}
|
2021-02-20 17:51:30 +00:00
|
|
|
toPemString() {
|
|
|
|
return plugins.nodeForge.pki.privateKeyToPem(this.forgePrivateKey);
|
|
|
|
}
|
|
|
|
}
|
2023-08-21 06:29:27 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8uY2xhc3Nlcy5wcml2YXRla2V5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRjcnlwdG8uY2xhc3Nlcy5wcml2YXRla2V5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sMEJBQTBCLENBQUM7QUFFcEQsTUFBTSxPQUFPLFVBQVU7SUFDckIsU0FBUztJQUNGLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQyxTQUFpQjtRQUNsRCxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztRQUN0RSxPQUFPLElBQUksVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3BDLENBQUM7SUFFTSxNQUFNLENBQUMsYUFBYSxDQUFDLFNBQWlCO1FBQzNDLE9BQU8sSUFBSSxVQUFVLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQztJQUM1RSxDQUFDO0lBS0QsWUFBWSxhQUErQztRQUN6RCxJQUFJLENBQUMsZUFBZSxHQUFHLGFBQWEsQ0FBQztJQUN2QyxDQUFDO0lBRU0sV0FBVztRQUNoQixPQUFPLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUM7SUFDckUsQ0FBQztDQUNGIn0=
|