name.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. var RelativeDistinguishedName_1, RDNSequence_1, Name_1;
  2. import { __decorate } from "tslib";
  3. import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnArray } from "@peculiar/asn1-schema";
  4. import { Convert } from "pvtsutils";
  5. let DirectoryString = class DirectoryString {
  6. constructor(params = {}) {
  7. Object.assign(this, params);
  8. }
  9. toString() {
  10. return (this.bmpString ||
  11. this.printableString ||
  12. this.teletexString ||
  13. this.universalString ||
  14. this.utf8String ||
  15. "");
  16. }
  17. };
  18. __decorate([
  19. AsnProp({ type: AsnPropTypes.TeletexString })
  20. ], DirectoryString.prototype, "teletexString", void 0);
  21. __decorate([
  22. AsnProp({ type: AsnPropTypes.PrintableString })
  23. ], DirectoryString.prototype, "printableString", void 0);
  24. __decorate([
  25. AsnProp({ type: AsnPropTypes.UniversalString })
  26. ], DirectoryString.prototype, "universalString", void 0);
  27. __decorate([
  28. AsnProp({ type: AsnPropTypes.Utf8String })
  29. ], DirectoryString.prototype, "utf8String", void 0);
  30. __decorate([
  31. AsnProp({ type: AsnPropTypes.BmpString })
  32. ], DirectoryString.prototype, "bmpString", void 0);
  33. DirectoryString = __decorate([
  34. AsnType({ type: AsnTypeTypes.Choice })
  35. ], DirectoryString);
  36. export { DirectoryString };
  37. let AttributeValue = class AttributeValue extends DirectoryString {
  38. constructor(params = {}) {
  39. super(params);
  40. Object.assign(this, params);
  41. }
  42. toString() {
  43. return this.ia5String || (this.anyValue ? Convert.ToHex(this.anyValue) : super.toString());
  44. }
  45. };
  46. __decorate([
  47. AsnProp({ type: AsnPropTypes.IA5String })
  48. ], AttributeValue.prototype, "ia5String", void 0);
  49. __decorate([
  50. AsnProp({ type: AsnPropTypes.Any })
  51. ], AttributeValue.prototype, "anyValue", void 0);
  52. AttributeValue = __decorate([
  53. AsnType({ type: AsnTypeTypes.Choice })
  54. ], AttributeValue);
  55. export { AttributeValue };
  56. export class AttributeTypeAndValue {
  57. constructor(params = {}) {
  58. this.type = "";
  59. this.value = new AttributeValue();
  60. Object.assign(this, params);
  61. }
  62. }
  63. __decorate([
  64. AsnProp({ type: AsnPropTypes.ObjectIdentifier })
  65. ], AttributeTypeAndValue.prototype, "type", void 0);
  66. __decorate([
  67. AsnProp({ type: AttributeValue })
  68. ], AttributeTypeAndValue.prototype, "value", void 0);
  69. let RelativeDistinguishedName = RelativeDistinguishedName_1 = class RelativeDistinguishedName extends AsnArray {
  70. constructor(items) {
  71. super(items);
  72. Object.setPrototypeOf(this, RelativeDistinguishedName_1.prototype);
  73. }
  74. };
  75. RelativeDistinguishedName = RelativeDistinguishedName_1 = __decorate([
  76. AsnType({ type: AsnTypeTypes.Set, itemType: AttributeTypeAndValue })
  77. ], RelativeDistinguishedName);
  78. export { RelativeDistinguishedName };
  79. let RDNSequence = RDNSequence_1 = class RDNSequence extends AsnArray {
  80. constructor(items) {
  81. super(items);
  82. Object.setPrototypeOf(this, RDNSequence_1.prototype);
  83. }
  84. };
  85. RDNSequence = RDNSequence_1 = __decorate([
  86. AsnType({ type: AsnTypeTypes.Sequence, itemType: RelativeDistinguishedName })
  87. ], RDNSequence);
  88. export { RDNSequence };
  89. let Name = Name_1 = class Name extends RDNSequence {
  90. constructor(items) {
  91. super(items);
  92. Object.setPrototypeOf(this, Name_1.prototype);
  93. }
  94. };
  95. Name = Name_1 = __decorate([
  96. AsnType({ type: AsnTypeTypes.Sequence })
  97. ], Name);
  98. export { Name };