smartcrypto/dist_ts/smartcrypto.classes.publickey.js

18 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

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