generateKey static method

String generateKey(
  1. Map<String, String> keys, {
  2. String type = "temporary",
})

The ClearKey from a Map. The key in map should be the kid with the associated value being the key. Both values should be provide in HEX format.

Implementation

static String generateKey(Map<String, String> keys,
    {String type = "temporary"}) {
  final Map keyMap = <String, dynamic>{"type": type};
  keyMap["keys"] = <Map<String, String>>[];
  keys.forEach((key, value) => keyMap["keys"]
      .add({"kty": "oct", "kid": _base64(key), "k": _base64(value)}));

  return jsonEncode(keyMap);
}