src/retrieve.js
/**
 * Sign a String with HMAC-SHA384
 *
 * @param {String} key The HMAC key to use for signing
 * @param {String} payload The String to sign
 * @returns {PromiseLike<ArrayBuffer>} The cryptographic signature
 */
Sign a String with HMAC-SHA384
@param {String} key The HMAC key to use for signing
@param {String} payload The String to sign
@returns {PromiseLike} The cryptographic signature
Sign a String with HMAC - SHA384 @param { String } key The HMAC key to use for signing @param { String } payload The String to sign @returns { PromiseLike } The cryptographic signature
function sign(key, payload) {
  const keyFormat = 'raw';
  const algorithm = { name: 'HMAC', hash: 'SHA-384' };
  const keyUsages = ['sign'];
  const crypto = cryptography();
  return MiniPromise.createPromise(function(resolve, reject) {
    cryptoOperationToPromise(crypto.subtle.importKey(keyFormat, str2ab(key), algorithm, true, keyUsages))
      .then(function (cryptoKey) {
        cryptoOperationToPromise(crypto.subtle.sign(algorithm, cryptoKey, payload))
          .then(function(bytes) {
            resolve(base64.encodeFromArrayBuffer(bytes));
          })
          .catch(reject);
      })
      .catch(reject);
  });
}
function sign ( key , payload ) { const keyFormat = 'raw' ; const algorithm = { name : 'HMAC' , hash : 'SHA-384' } ; const keyUsages = [ 'sign' ] ; const crypto = cryptography ( ) ; return MiniPromise . createPromise ( function ( resolve , reject ) { cryptoOperationToPromise ( crypto . subtle . importKey ( keyFormat , str2ab ( key ) , algorithm , true , keyUsages ) ) . then ( function ( cryptoKey ) { cryptoOperationToPromise ( crypto . subtle . sign ( algorithm , cryptoKey , payload ) ) . then ( function ( bytes ) { resolve ( base64 . encodeFromArrayBuffer ( bytes ) ) ; } ) . catch ( reject ) ; } ) . catch ( reject ) ; } ) ; }
Sign a String with HMAC-SHA384
 @param {String} key The HMAC key to use for signing
 @param {String} payload The String to sign
 @returns {PromiseLike<ArrayBuffer>} The cryptographic signature
Sign a String with HMAC - SHA384 @param { String } key The HMAC key to use for signing @param { String } payload The String to sign @returns { PromiseLike<ArrayBuffer > } The cryptographic signature