 
   _make_mac : (enc = null) ->
     msg = @_pack true
-    key = utils.base64u.decode @key
+    key = decode @key
     hm = crypto.createHmac 'sha512', key
     hm.update msg
     hm.digest()

  generate_to_client : (cb) ->
    await @generate defer err, ret
    if not err? and ret?
      ret = utils.base64u.encode ret
    cb err, ret
  
  #-----------------------------------------

  pack_to_client : () -> utils.base64u.encode @_pack false
    
##=======================================================================


constants      = require './constants'
sc             = require('./status').codes
mm             = require('./mod').mgr

##=======================================================================

encode = (s) -> s.toString 'base64'
decode = (b) -> new Buffer b, 'base64'

##=======================================================================

