> **Experimental**
>
> `@aws-cdk/aws-mediapackagev2-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# TsSpekeEncryptionProps

Struct · [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)

Properties for TS SPEKE encryption configuration.

Used as argument in: [TsEncryption.speke](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.TsEncryption.html#speke)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/endpoint.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/endpoint.ts#L2072)

## Example

TypeScript:

```ts
declare const channel: Channel;
declare const spekeRole: iam.IRole;

new OriginEndpoint(this, 'TsEndpoint', {
  channel,
  segment: Segment.ts({
    encryption: TsEncryption.speke({
      method: TsEncryptionMethod.SAMPLE_AES,
      resourceId: 'my-content-id',
      url: 'https://example.com/speke',
      role: spekeRole,
    }),
  }),
  manifests: [Manifest.hls({ manifestName: 'index' })],
});
```

Python:

```python
# channel: Channel
# speke_role: iam.IRole

OriginEndpoint(self, "TsEndpoint",
    channel=channel,
    segment=Segment.ts(
        encryption=TsEncryption.speke(
            method=TsEncryptionMethod.SAMPLE_AES,
            resource_id="my-content-id",
            url="https://example.com/speke",
            role=speke_role
        )
    ),
    manifests=[Manifest.hls(manifest_name="index")]
)
```

Java:

```java
Channel channel;
IRole spekeRole;

OriginEndpoint.Builder.create(this, "TsEndpoint")
        .channel(channel)
        .segment(Segment.ts(TsSegmentProps.builder()
                .encryption(TsEncryption.speke(TsSpekeEncryptionProps.builder()
                        .method(TsEncryptionMethod.SAMPLE_AES)
                        .resourceId("my-content-id")
                        .url("https://example.com/speke")
                        .role(spekeRole)
                        .build()))
                .build()))
        .manifests(List.of(Manifest.hls(HlsManifestConfiguration.builder().manifestName("index").build())))
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.MediaPackageV2.Alpha
Channel channel;
IRole spekeRole;

new OriginEndpoint(this, "TsEndpoint", new OriginEndpointProps {
    Channel = channel,
    Segment = Segment.Ts(new TsSegmentProps {
        Encryption = TsEncryption.Speke(new TsSpekeEncryptionProps {
            Method = TsEncryptionMethod.SAMPLE_AES,
            ResourceId = "my-content-id",
            Url = "https://example.com/speke",
            Role = spekeRole
        })
    }),
    Manifests = new [] { Manifest.Hls(new HlsManifestConfiguration { ManifestName = "index" }) }
});
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awsmediapackagev2alpha/v2
var channel Channel
var spekeRole IRole

awsmediapackagev2alpha.NewOriginEndpoint(this, jsii.String("TsEndpoint"), &OriginEndpointProps{
	Channel: Channel,
	Segment: awsmediapackagev2alpha.Segment_Ts(&TsSegmentProps{
		Encryption: awsmediapackagev2alpha.TsEncryption_Speke(&TsSpekeEncryptionProps{
			Method: awsmediapackagev2alpha.TsEncryptionMethod_SAMPLE_AES,
			ResourceId: jsii.String("my-content-id"),
			Url: jsii.String("https://example.com/speke"),
			Role: spekeRole,
		}),
	}),
	Manifests: []Manifest{
		awsmediapackagev2alpha.Manifest_Hls(&HlsManifestConfiguration{
			ManifestName: jsii.String("index"),
		}),
	},
})
```

## Properties

- `audioPreset`: [PresetSpeke20Audio](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.PresetSpeke20Audio.html) — Audio encryption preset.

  **Default:** PresetSpeke20Audio.PRESET_AUDIO_1

- `certificate`: [ICertificate](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_certificatemanager.ICertificate.html) — The ARN of the certificate that you imported to AWS Certificate Manager to add content key encryption to this endpoint.

  **Default:** no content key encryption

  For this feature to work, your DRM key provider must support content key encryption.

- `constantInitializationVector`: string — Constant initialization vector (32-character hex string).

  **Default:** MediaPackage generates the IV

  A 128-bit, 16-byte hex value represented by a 32-character string,
  used in conjunction with the key for encrypting content.

- `drmSystems`: [TsDrmSystem](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.TsDrmSystem.html)[] — The DRM systems to use for content protection.

  **Default:** FairPlay for SAMPLE_AES, Clear Key AES 128 for AES_128

- `keyRotationInterval`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Key rotation interval.

  **Default:** no rotation

- `method`: [TsEncryptionMethod](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.TsEncryptionMethod.html) (required) — The encryption method to use.

- `resourceId`: string (required) — The unique identifier for the content.

  The service sends this identifier to the key server to identify the current endpoint.
  How unique you make this identifier depends on how fine-grained you want access controls to be.
  The service does not permit you to use the same ID for two simultaneous encryption processes.

- `role`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) (required) — IAM role for accessing the key provider API.

  This role must have a trust policy that allows MediaPackage to assume the role,
  and it must have sufficient permissions to access the key retrieval URL.

- `url`: string (required) — URL of the SPEKE key provider.

- `videoPreset`: [PresetSpeke20Video](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.PresetSpeke20Video.html) — Video encryption preset.

  **Default:** PresetSpeke20Video.PRESET_VIDEO_1
