From 4df2a9e2e460d88f27350c5e3eb98015ca7eef2b Mon Sep 17 00:00:00 2001
From: bcoe Extensions to the
Crypto
interface
[Exposed=(Window,Worker)] - partial interface Crypto { + partial interface Crypto { DOMString randomUUID(); };+
randomUUID()
method.randomUUID()
+ method steps are:
+
+ Let array be a new Uint16Array
with 8 elements.
+
+ Overwrite all elements of array with cryptographically random values of + a 16-bit unsigned integer type. +
++ Let timeLow be an 8 character hexadecimal string + populated as follows: +
+
+ Let a be the 4 character hexadecimal representation
+ of array[0]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Let b be the 4 character hexadecimal representation
+ of array[1]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Set timeLow equal to a appended to + b (left to right). +
+
+ Let timeMid be the 4 character hexadecimal representation
+ of array[2]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Let timeHighAndVersion be a 4 character hexidecimal string + populated as follows: +
+
+ Set the 4 most significant bits of array[3]
+ to 0b0100
.
+
+ Set timeHighAndVersion equal to the 4 character hexadecimal representation
+ of array[3]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Let clockSeqAndReservedClockSeqLow be a 4 character hexidecimal string + populated as follows: +
+
+ Set the 2 most significant bits of array[4]
+ to 0b01
.
+
+ Set clockSeqAndReservedClockSeqLow equal to the 4 character hexadecimal representation
+ of array[4]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Let node be an 12 character hexadecimal string + populated as follows: +
+
+ Let c be the 4 character hexadecimal representation
+ of array[5]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Let d be the 4 character hexadecimal representation
+ of array[6]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Let e be the 4 character hexadecimal representation
+ of array[7]
, left padding the string with
+ "0"
until 4 characters are reached.
+
+ Set node to the string created by appending + c to d to e (left to right). +
+
+ Return the DOMString
+ created by appending timeLow to timeMid to
+ timeHighAndVersion to clockSeqAndReservedClockSeqLow
+ to node (left to right) separating each hexadecimal string by
+ "-"
.
+