You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SFrameDecrypterStream includes GenericTransformStream;
263
-
SFrameDecrypterStream includes SFrameKeyManagement;
269
+
SFrameDecrypterStream includes SFrameDecrypterManagement;
264
270
265
271
enum SFrameTransformErrorEventType {
266
272
"authentication",
@@ -335,14 +341,40 @@ The <dfn>SFrame transform algorithm</dfn>, given |this| and |frame|, runs these
335
341
1. [=ReadableStream/Enqueue=] |frame| in |this|.`[[transform]]`.
336
342
337
343
## Methods ## {#sframe-transform-methods}
338
-
The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> method steps are:
344
+
The <dfn method for="SFrameEncrypterKeyManager">setEncryptionKey(|key|, |keyID|)</dfn> method steps are:
345
+
1. Let |promise| be [=a new promise=].
346
+
1. If |keyId| is <code>undefined</code>, run the following steps:
347
+
1. Let |currentKeyId| be |this|.`[[currentKeyId]]` if not undefined or 0 otherwise.
348
+
1. If |currentKeyId| is greater or equal to 2<sup>64</sup>-1, [=reject=] |promise| with a {{RangeError}} exception and abort these steps.
349
+
1. Set |keyId| to |currentKeyId| incremented by 1.
350
+
1. 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 and abort these steps.
351
+
1. Set |this|.`[[currentKeyId]]` to |keyId|.
352
+
1. [=In parallel=], run the following steps:
353
+
1. Set |key| and |keyID| as key material to use for the SFrame transform encryption algorithm, as defined by [[RFC9605]].
354
+
1. If setting the key material fails, [=queue a task=] to [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
355
+
1. [=Queue a task=] to [=resolve=] |promise| with undefined.
356
+
1. Return |promise|.
357
+
358
+
The <dfn method for="SFrameDecrypterKeyManager">addEncryptionKey(|key|, |keyID|)</dfn> method steps are:
339
359
1. Let |promise| be [=a new promise=].
340
-
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.
341
-
3. Otherwise, [=in parallel=], run the following steps:
342
-
1. Set |key| with its optional |keyID| as key material to use for the SFrame transform algorithm, as defined by [[RFC9605]].
343
-
2. If setting the key material fails, [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
344
-
3. [=Resolve=] |promise| with undefined.
345
-
4. Return |promise|.
360
+
1. 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, and abort these steps..
361
+
1. [=In parallel=], run the following steps:
362
+
1. Let |keyStore| be the key store used for the SFrame transform algorithm, as defined by [[RFC9605]].
363
+
1. Set an entry to |keyStore| with |keyId| as key and |keyValue| as value. This overrides any existing entry to |keyId|.
364
+
1. If setting the key material fails, [=queue a task=] to [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
365
+
1. [=Resolve=] |promise| with undefined.
366
+
1. Return |promise|.
367
+
368
+
// FIXME: Should SFrameTransform receiver be made aware of the current key in use, so that it would call removeEncryptionKey appropriately.
369
+
// Or should we add an option to let the UA remove the key automatically on new KeyID?
370
+
The <dfn method for="SFrameDecrypterKeyManager">removeEncryptionKey(|key|, |keyID|)</dfn> method steps are:
371
+
1. Let |promise| be [=a new promise=].
372
+
1. 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, and abort these steps.
373
+
1. [=In parallel=], run the following steps:
374
+
1. Let |keyStore| be the key store used for the SFrame transform algorithm, as defined by [[RFC9605]].
375
+
1. Remove the entry of |keyStore| at |keyId| if it exits.
0 commit comments