@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
43 lines • 1.4 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const RsaPublicKey_1 = require("./RsaPublicKey");
const clone = require('clone');
/**
* Represents an Elliptic Curve private key
* @class
* @extends PrivateKey
*/
class RsaPrivateKey extends RsaPublicKey_1.default {
/**
* Create instance of @class RsaPrivateKey
*/
constructor(key) {
super(key);
this.d = key.d;
this.p = key.p;
this.q = key.q;
this.dp = key.dp;
this.dq = key.dq;
this.qi = key.qi;
}
/**
* Gets the corresponding public key
* @returns The corresponding {@link PublicKey}
*/
getPublicKey() {
const publicKey = clone(this);
delete publicKey.d;
delete publicKey.p;
delete publicKey.q;
delete publicKey.dp;
delete publicKey.dq;
delete publicKey.qi;
return publicKey;
}
}
exports.default = RsaPrivateKey;
//# sourceMappingURL=RsaPrivateKey.js.map