Skip to content

Commit bb65dbe

Browse files
authored
🤖 Merge PR DefinitelyTyped#72880 fix(sdp-transform): Update type definition of MediaAttributes.crypto by @gaerini
1 parent 74a5c63 commit bb65dbe

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

‎types/sdp-transform/index.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ export interface MediaAttributes extends SharedAttributes {
178178
// a=maxptime
179179
maxptime?: number | undefined;
180180
// a=crypto
181-
crypto?: {
181+
crypto?: Array<{
182182
id: number;
183183
suite: string;
184184
config: string;
185185
sessionConfig?: string | undefined;
186-
} | undefined;
186+
}> | undefined;
187187
// a=candidate
188188
candidates?:
189189
| Array<{

‎types/sdp-transform/sdp-transform-tests.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,22 @@ function test_parse_simulcast_stream_list() {
4848
}
4949
}
5050
}
51+
52+
function test_crypto_attribute() {
53+
const session: SessionDescription = parse("");
54+
session.media[0].crypto = [
55+
{
56+
id: 1,
57+
suite: "AES_CM_128_HMAC_SHA1_80",
58+
config: "inline:WVNfX19zZW1jdGwgKCkgewkyMjA7fQp9CnVubGVz|2^31|1:1",
59+
sessionConfig: "UNENCRYPTED_SRTP",
60+
},
61+
];
62+
const sdp: string = write(session);
63+
const parsed = parse(sdp);
64+
const crypto = parsed.media[0].crypto![0];
65+
crypto.id; // $ExpectType number
66+
crypto.suite; // $ExpectType string
67+
crypto.config; // $ExpectType string
68+
crypto.sessionConfig; // $ExpectType string | undefined
69+
}

0 commit comments

Comments
 (0)