name.js 3.4 KB

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