41 lines
2.5 KiB
JavaScript
41 lines
2.5 KiB
JavaScript
|
"use strict";
|
||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
|
if (k2 === undefined) k2 = k;
|
||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
|
}) : (function(o, m, k, k2) {
|
||
|
if (k2 === undefined) k2 = k;
|
||
|
o[k2] = m[k];
|
||
|
}));
|
||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
|
}) : function(o, v) {
|
||
|
o["default"] = v;
|
||
|
});
|
||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||
|
if (mod && mod.__esModule) return mod;
|
||
|
var result = {};
|
||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
|
__setModuleDefault(result, mod);
|
||
|
return result;
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.PublicKey = void 0;
|
||
|
const plugins = __importStar(require("./smartcrypto.plugins"));
|
||
|
class PublicKey {
|
||
|
constructor(publicKeyArg) {
|
||
|
this.forgePublicKey = publicKeyArg;
|
||
|
}
|
||
|
// 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));
|
||
|
}
|
||
|
toPemString() {
|
||
|
return plugins.nodeForge.pki.publicKeyToPem(this.forgePublicKey);
|
||
|
}
|
||
|
}
|
||
|
exports.PublicKey = PublicKey;
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjcnlwdG8uY2xhc3Nlcy5wdWJsaWNrZXku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