chromium/third_party/blink/web_tests/crypto/subtle/hmac/cloneKey-empty.html

<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>

<script>
description("Tests structured de-cloning of empty HMAC keys");

// It used to be possible to import empty HMAC keys, so it is possible that
// such keys were persisted to storage. This test verifies that such keys can
// still be successfully de-serialized.
//
// The version number of the serialized format used is 7.

var serializedKeyHex = "ff073f004b0200050900";

key = internals.deserializeBuffer(hexStringToUint8Array(serializedKeyHex).buffer);

shouldEvaluateAs("key.type", "secret");
shouldEvaluateAs("key.extractable", true);
shouldEvaluateAs("key.algorithm.name", "HMAC");
shouldEvaluateAs("key.algorithm.length", 0);
shouldEvaluateAs("key.algorithm.hash.name", "SHA-1");
shouldEvaluateAs("key.usages.toString()", "sign");

</script>

</body>
</html>