enveloped_data.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var UnprotectedAttributes_1;
  2. import { __decorate } from "tslib";
  3. import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from "@peculiar/asn1-schema";
  4. import { CMSVersion } from "./types";
  5. import { Attribute } from "./attribute";
  6. import { RecipientInfos } from "./recipient_infos";
  7. import { OriginatorInfo } from "./originator_info";
  8. import { EncryptedContentInfo } from "./encrypted_content_info";
  9. let UnprotectedAttributes = UnprotectedAttributes_1 = class UnprotectedAttributes extends AsnArray {
  10. constructor(items) {
  11. super(items);
  12. Object.setPrototypeOf(this, UnprotectedAttributes_1.prototype);
  13. }
  14. };
  15. UnprotectedAttributes = UnprotectedAttributes_1 = __decorate([
  16. AsnType({ type: AsnTypeTypes.Set, itemType: Attribute })
  17. ], UnprotectedAttributes);
  18. export { UnprotectedAttributes };
  19. export class EnvelopedData {
  20. constructor(params = {}) {
  21. this.version = CMSVersion.v0;
  22. this.recipientInfos = new RecipientInfos();
  23. this.encryptedContentInfo = new EncryptedContentInfo();
  24. Object.assign(this, params);
  25. }
  26. }
  27. __decorate([
  28. AsnProp({ type: AsnPropTypes.Integer })
  29. ], EnvelopedData.prototype, "version", void 0);
  30. __decorate([
  31. AsnProp({ type: OriginatorInfo, context: 0, implicit: true, optional: true })
  32. ], EnvelopedData.prototype, "originatorInfo", void 0);
  33. __decorate([
  34. AsnProp({ type: RecipientInfos })
  35. ], EnvelopedData.prototype, "recipientInfos", void 0);
  36. __decorate([
  37. AsnProp({ type: EncryptedContentInfo })
  38. ], EnvelopedData.prototype, "encryptedContentInfo", void 0);
  39. __decorate([
  40. AsnProp({ type: UnprotectedAttributes, context: 1, implicit: true, optional: true })
  41. ], EnvelopedData.prototype, "unprotectedAttrs", void 0);