Skip to content

Commit 566cd58

Browse files
Add support for long keyID values (#77)
* Add support for long keyID values * Update index.bs Co-authored-by: Martin Thomson <[email protected]> * Update index.bs * Update index.bs * Add BigInt workaround * BigInt link fix Co-authored-by: Martin Thomson <[email protected]>
1 parent b5fae15 commit 566cd58

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

index.bs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ spec:webidl; type:dfn; text:resolve
2828
<pre class=link-defaults>
2929
spec:streams; type:interface; text:ReadableStream
3030
</pre>
31+
<pre class=anchors>
32+
url: https://heycam.github.io/webidl/#idl-bigint; type: interface; text: BigInt
33+
</pre>
3134

3235
# Introduction # {#introduction}
3336

@@ -191,10 +194,13 @@ dictionary SFrameTransformOptions {
191194
SFrameTransformRole role = "encrypt";
192195
};
193196

197+
typedef [EnforceRange] unsigned long long SmallCryptoKeyID;
198+
typedef (SmallCryptoKeyID or BigInt) CryptoKeyID;
199+
194200
[Exposed=(Window,DedicatedWorker)]
195201
interface SFrameTransform {
196202
constructor(optional SFrameTransformOptions options = {});
197-
Promise<undefined> setEncryptionKey(CryptoKey key, optional unsigned long long keyID);
203+
Promise<undefined> setEncryptionKey(CryptoKey key, optional CryptoKeyID keyID);
198204
};
199205
SFrameTransform includes GenericTransformStream;
200206
</xmp>
@@ -227,11 +233,12 @@ The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |
227233
## Methods
228234
The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> method steps are:
229235
1. Let |promise| be [=a new promise=].
230-
2. [=In parallel=], run the following steps:
236+
2. If |keyID| is a {{BigInt}} which cannot be represented as a integer between 0 and 2<sup>64</sup>-1 inclusive, [=reject=] |promise| with a {{RangeError}} exception.
237+
3. Otherwise, [=in parallel=], run the following steps:
231238
1. Set |key| with its optional |keyID| as key material to use for the SFrame transform algorithm, as defined by the <a href="https://datatracker.ietf.org/doc/draft-omara-sframe/">SFrame specification</a>.
232-
2. If setting the key material fails, [=Reject=] |promise| with an {{InvalidModificationError}} error and abort these steps.
239+
2. If setting the key material fails, [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
233240
3. [=Resolve=] |promise| with undefined.
234-
3. Return |promise|.
241+
4. Return |promise|.
235242

236243

237244
# RTCRtpScriptTransform # {#scriptTransform}

0 commit comments

Comments
 (0)