|
|
|
|
30
|
* Ratchets a key. See
|
30
|
* Ratchets a key. See
|
31
|
* https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
|
31
|
* https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
|
32
|
* @param {CryptoKey} material - base key material
|
32
|
* @param {CryptoKey} material - base key material
|
33
|
- * @returns {ArrayBuffer} - ratcheted key material
|
|
|
|
|
33
|
+ * @returns {Promise<ArrayBuffer>} - ratcheted key material
|
34
|
*/
|
34
|
*/
|
35
|
export async function ratchet(material) {
|
35
|
export async function ratchet(material) {
|
36
|
const textEncoder = new TextEncoder();
|
36
|
const textEncoder = new TextEncoder();
|
|
|
|
|
49
|
* suitable for our usage.
|
49
|
* suitable for our usage.
|
50
|
* @param {ArrayBuffer} keyBytes - raw key
|
50
|
* @param {ArrayBuffer} keyBytes - raw key
|
51
|
* @param {Array} keyUsages - key usages, see importKey documentation
|
51
|
* @param {Array} keyUsages - key usages, see importKey documentation
|
52
|
- * @returns {CryptoKey} - the WebCrypto key.
|
|
|
|
|
52
|
+ * @returns {Promise<CryptoKey>} - the WebCrypto key.
|
53
|
*/
|
53
|
*/
|
54
|
export async function importKey(keyBytes) {
|
54
|
export async function importKey(keyBytes) {
|
55
|
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
|
55
|
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
|