name.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 || this.printableString || this.teletexString || this.universalString || this.utf8String || "";
  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. ia5String;
  39. anyValue;
  40. constructor(params = {}) {
  41. super(params);
  42. Object.assign(this, params);
  43. }
  44. toString() {
  45. return this.ia5String || (this.anyValue ? hex.encode(this.anyValue) : super.toString());
  46. }
  47. };
  48. __decorate([
  49. AsnProp({ type: AsnPropTypes.IA5String })
  50. ], AttributeValue.prototype, "ia5String", void 0);
  51. __decorate([
  52. AsnProp({ type: AsnPropTypes.Any })
  53. ], AttributeValue.prototype, "anyValue", void 0);
  54. AttributeValue = __decorate([
  55. AsnType({ type: AsnTypeTypes.Choice })
  56. ], AttributeValue);
  57. export { AttributeValue };
  58. export class AttributeTypeAndValue {
  59. type = "";
  60. value = new AttributeValue();
  61. constructor(params = {}) {
  62. Object.assign(this, params);
  63. }
  64. }
  65. __decorate([
  66. AsnProp({ type: AsnPropTypes.ObjectIdentifier })
  67. ], AttributeTypeAndValue.prototype, "type", void 0);
  68. __decorate([
  69. AsnProp({ type: AttributeValue })
  70. ], AttributeTypeAndValue.prototype, "value", void 0);
  71. let RelativeDistinguishedName = RelativeDistinguishedName_1 = class RelativeDistinguishedName extends AsnArray {
  72. constructor(items) {
  73. super(items);
  74. Object.setPrototypeOf(this, RelativeDistinguishedName_1.prototype);
  75. }
  76. };
  77. RelativeDistinguishedName = RelativeDistinguishedName_1 = __decorate([
  78. AsnType({
  79. type: AsnTypeTypes.Set,
  80. itemType: AttributeTypeAndValue,
  81. })
  82. ], RelativeDistinguishedName);
  83. export { RelativeDistinguishedName };
  84. let RDNSequence = RDNSequence_1 = class RDNSequence extends AsnArray {
  85. constructor(items) {
  86. super(items);
  87. Object.setPrototypeOf(this, RDNSequence_1.prototype);
  88. }
  89. };
  90. RDNSequence = RDNSequence_1 = __decorate([
  91. AsnType({
  92. type: AsnTypeTypes.Sequence,
  93. itemType: RelativeDistinguishedName,
  94. })
  95. ], RDNSequence);
  96. export { RDNSequence };
  97. let Name = Name_1 = class Name extends RDNSequence {
  98. constructor(items) {
  99. super(items);
  100. Object.setPrototypeOf(this, Name_1.prototype);
  101. }
  102. };
  103. Name = Name_1 = __decorate([
  104. AsnType({ type: AsnTypeTypes.Sequence })
  105. ], Name);
  106. export { Name };