/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
import { KeyType } from '../KeyTypeFactory';
import JsonWebKey from '../JsonWebKey';
import PublicKey from '../PublicKey';

/**
 * Represents an Elliptic Curve public key
 * @class
 * @extends PublicKey
 */
export default class EcPublicKey extends JsonWebKey implements PublicKey {
  /**
   * curve
   */
  public crv: string | undefined;
  /**
   * x co-ordinate
   */
  public x: string;
  /**
   * y co-ordinate
   */
  public y: string;
  /**
   * Set the EC key type
   */
  kty = KeyType.EC;

  /**
   * Create instance of @class EcPublicKey
   */
  constructor (key: EcPublicKey) {
    super(key);
    this.crv = key.crv;
    this.x = key.x;
    this.y = key.y;
  }
}
