private_key_info.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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({ type: AsnTypeTypes.Sequence, itemType: Attribute })
  19. ], Attributes);
  20. export { Attributes };
  21. export class PrivateKeyInfo {
  22. constructor(params = {}) {
  23. this.version = Version.v1;
  24. this.privateKeyAlgorithm = new AlgorithmIdentifier();
  25. this.privateKey = new PrivateKey();
  26. Object.assign(this, params);
  27. }
  28. }
  29. __decorate([
  30. AsnProp({ type: AsnPropTypes.Integer })
  31. ], PrivateKeyInfo.prototype, "version", void 0);
  32. __decorate([
  33. AsnProp({ type: AlgorithmIdentifier })
  34. ], PrivateKeyInfo.prototype, "privateKeyAlgorithm", void 0);
  35. __decorate([
  36. AsnProp({ type: PrivateKey })
  37. ], PrivateKeyInfo.prototype, "privateKey", void 0);
  38. __decorate([
  39. AsnProp({ type: Attributes, implicit: true, context: 0, optional: true })
  40. ], PrivateKeyInfo.prototype, "attributes", void 0);