(config)
| 784 | } |
| 785 | |
| 786 | _parseKmsKmip(config) { |
| 787 | this.kmip = { |
| 788 | client: { |
| 789 | /** Enable this option if the KMIP Server supports |
| 790 | * Create and Activate in one operation. |
| 791 | * Leave it disabled to prevent clock desynchronisation |
| 792 | * issues because the two steps creation uses server's |
| 793 | * time for `now' instead of client specified activation date |
| 794 | * which also targets the present instant. |
| 795 | */ |
| 796 | compoundCreateActivate: |
| 797 | (process.env.S3KMIP_COMPOUND_CREATE === 'true') || false, |
| 798 | /** Set the bucket name attribute name here if the KMIP |
| 799 | * server supports storing custom attributes along |
| 800 | * with the keys. |
| 801 | */ |
| 802 | bucketNameAttributeName: |
| 803 | process.env.S3KMIP_BUCKET_ATTRIBUTE_NAME || '', |
| 804 | }, |
| 805 | transport: this._parseKmipTransport({}), |
| 806 | retries: 0, |
| 807 | }; |
| 808 | if (config.kmip) { |
| 809 | assert(config.kmip.providerName, 'config.kmip.providerName must be defined'); |
| 810 | assert(isValidProvider(config.kmip.providerName), |
| 811 | 'config.kmip.providerName must be lowercase alphanumeric only'); |
| 812 | this.kmip.providerName = config.kmip.providerName; |
| 813 | if (config.kmip.client) { |
| 814 | if (config.kmip.client.compoundCreateActivate) { |
| 815 | assert(typeof config.kmip.client.compoundCreateActivate === |
| 816 | 'boolean'); |
| 817 | this.kmip.client.compoundCreateActivate = |
| 818 | config.kmip.client.compoundCreateActivate; |
| 819 | } |
| 820 | if (config.kmip.client.bucketNameAttributeName) { |
| 821 | assert(typeof config.kmip.client.bucketNameAttributeName === |
| 822 | 'string'); |
| 823 | this.kmip.client.bucketNameAttributeName = |
| 824 | config.kmip.client.bucketNameAttributeName; |
| 825 | } |
| 826 | } |
| 827 | if (config.kmip.transport) { |
| 828 | if (Array.isArray(config.kmip.transport)) { |
| 829 | this.kmip.transport = config.kmip.transport.map(t => |
| 830 | this._parseKmipTransport(t)); |
| 831 | if (config.kmip.retries) { |
| 832 | assert(typeof config.kmip.retries === 'number', |
| 833 | 'bad config: KMIP Cluster retries must be a number'); |
| 834 | assert(config.kmip.retries <= this.kmip.transport.length - 1, |
| 835 | 'bad config: KMIP Cluster retries must be lower or equal to the number of hosts - 1'); |
| 836 | } else { |
| 837 | this.kmip.retries = this.kmip.transport.length - 1; |
| 838 | } |
| 839 | } else { |
| 840 | this.kmip.transport = |
| 841 | this._parseKmipTransport(config.kmip.transport); |
| 842 | } |
| 843 | } |
no test coverage detected