name.js 4.3 KB

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