general_name.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import { __decorate } from "tslib";
  2. import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnOctetStringConverter } from "@peculiar/asn1-schema";
  3. import { IpConverter } from "./ip_converter.js";
  4. import { DirectoryString, Name } from "./name.js";
  5. export const AsnIpConverter = {
  6. fromASN: (value) => IpConverter.toString(AsnOctetStringConverter.fromASN(value)),
  7. toASN: (value) => AsnOctetStringConverter.toASN(IpConverter.fromString(value)),
  8. };
  9. export class OtherName {
  10. typeId = "";
  11. value = new ArrayBuffer(0);
  12. constructor(params = {}) {
  13. Object.assign(this, params);
  14. }
  15. }
  16. __decorate([
  17. AsnProp({ type: AsnPropTypes.ObjectIdentifier })
  18. ], OtherName.prototype, "typeId", void 0);
  19. __decorate([
  20. AsnProp({
  21. type: AsnPropTypes.Any,
  22. context: 0,
  23. })
  24. ], OtherName.prototype, "value", void 0);
  25. export class EDIPartyName {
  26. nameAssigner;
  27. partyName = new DirectoryString();
  28. constructor(params = {}) {
  29. Object.assign(this, params);
  30. }
  31. }
  32. __decorate([
  33. AsnProp({
  34. type: DirectoryString,
  35. optional: true,
  36. context: 0,
  37. implicit: true,
  38. })
  39. ], EDIPartyName.prototype, "nameAssigner", void 0);
  40. __decorate([
  41. AsnProp({
  42. type: DirectoryString,
  43. context: 1,
  44. implicit: true,
  45. })
  46. ], EDIPartyName.prototype, "partyName", void 0);
  47. let GeneralName = class GeneralName {
  48. otherName;
  49. rfc822Name;
  50. dNSName;
  51. x400Address;
  52. directoryName;
  53. ediPartyName;
  54. uniformResourceIdentifier;
  55. iPAddress;
  56. registeredID;
  57. constructor(params = {}) {
  58. Object.assign(this, params);
  59. }
  60. };
  61. __decorate([
  62. AsnProp({
  63. type: OtherName,
  64. context: 0,
  65. implicit: true,
  66. })
  67. ], GeneralName.prototype, "otherName", void 0);
  68. __decorate([
  69. AsnProp({
  70. type: AsnPropTypes.IA5String,
  71. context: 1,
  72. implicit: true,
  73. })
  74. ], GeneralName.prototype, "rfc822Name", void 0);
  75. __decorate([
  76. AsnProp({
  77. type: AsnPropTypes.IA5String,
  78. context: 2,
  79. implicit: true,
  80. })
  81. ], GeneralName.prototype, "dNSName", void 0);
  82. __decorate([
  83. AsnProp({
  84. type: AsnPropTypes.Any,
  85. context: 3,
  86. implicit: true,
  87. })
  88. ], GeneralName.prototype, "x400Address", void 0);
  89. __decorate([
  90. AsnProp({
  91. type: Name,
  92. context: 4,
  93. implicit: false,
  94. })
  95. ], GeneralName.prototype, "directoryName", void 0);
  96. __decorate([
  97. AsnProp({
  98. type: EDIPartyName,
  99. context: 5,
  100. })
  101. ], GeneralName.prototype, "ediPartyName", void 0);
  102. __decorate([
  103. AsnProp({
  104. type: AsnPropTypes.IA5String,
  105. context: 6,
  106. implicit: true,
  107. })
  108. ], GeneralName.prototype, "uniformResourceIdentifier", void 0);
  109. __decorate([
  110. AsnProp({
  111. type: AsnPropTypes.OctetString,
  112. context: 7,
  113. implicit: true,
  114. converter: AsnIpConverter,
  115. })
  116. ], GeneralName.prototype, "iPAddress", void 0);
  117. __decorate([
  118. AsnProp({
  119. type: AsnPropTypes.ObjectIdentifier,
  120. context: 8,
  121. implicit: true,
  122. })
  123. ], GeneralName.prototype, "registeredID", void 0);
  124. GeneralName = __decorate([
  125. AsnType({ type: AsnTypeTypes.Choice })
  126. ], GeneralName);
  127. export { GeneralName };