Skip to content

Commit

Permalink
Implement crypto.randomUUID()
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbvaughan committed May 27, 2023
1 parent 35259cc commit 8d7155a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/jsdom/living/crypto/Crypto-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class CryptoImpl {
nodeCrypto.randomFillSync(array);
return array;
}

// https://w3c.github.io/webcrypto/#Crypto-method-randomUUID
randomUUID() {
return nodeCrypto.randomUUID();
}
}

exports.implementation = CryptoImpl;
Expand Down
1 change: 1 addition & 0 deletions lib/jsdom/living/crypto/Crypto.webidl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[Exposed=(Window,Worker)]
interface Crypto {
ArrayBufferView getRandomValues(ArrayBufferView array);
[SecureContext] DOMString randomUUID();
};
1 change: 0 additions & 1 deletion test/web-platform-tests/to-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ DIR: WebCryptoAPI
"*/**": [fail, Not implemented]
algorithm-discards-context.https.window.html: [fail-slow, Tests non-implemented methods]
idlharness.https.any.html: [fail, Unknown]
randomUUID.https.any.html: [fail, Not implemented]

---

Expand Down

0 comments on commit 8d7155a

Please sign in to comment.