private_key_info.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. var Attributes_1;
  2. import { __decorate } from "tslib";
  3. import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString } from "@peculiar/asn1-schema";
  4. import { AlgorithmIdentifier, Attribute } from "@peculiar/asn1-x509";
  5. export var Version;
  6. (function (Version) {
  7. Version[Version["v1"] = 0] = "v1";
  8. })(Version || (Version = {}));
  9. export class PrivateKey extends OctetString {
  10. }
  11. let Attributes = Attributes_1 = class Attributes extends AsnArray {
  12. constructor(items) {
  13. super(items);
  14. Object.setPrototypeOf(this, Attributes_1.prototype);
  15. }
  16. };
  17. Attributes = Attributes_1 = __decorate([
  18. AsnType({
  19. type: AsnTypeTypes.Sequence,
  20. itemType: Attribute,
  21. })
  22. ], Attributes);
  23. export { Attributes };
  24. export class PrivateKeyInfo {
  25. version = Version.v1;
  26. privateKeyAlgorithm = new AlgorithmIdentifier();
  27. privateKey = new PrivateKey();
  28. attributes;
  29. constructor(params = {}) {
  30. Object.assign(this, params);
  31. }
  32. }
  33. __decorate([
  34. AsnProp({ type: AsnPropTypes.Integer })
  35. ], PrivateKeyInfo.prototype, "version", void 0);
  36. __decorate([
  37. AsnProp({ type: AlgorithmIdentifier })
  38. ], PrivateKeyInfo.prototype, "privateKeyAlgorithm", void 0);
  39. __decorate([
  40. AsnProp({ type: PrivateKey })
  41. ], PrivateKeyInfo.prototype, "privateKey", void 0);
  42. __decorate([
  43. AsnProp({
  44. type: Attributes,
  45. implicit: true,
  46. context: 0,
  47. optional: true,
  48. })
  49. ], PrivateKeyInfo.prototype, "attributes", void 0);