def compute_wcs(key, challenge):
 assert (type(key) in [six.text_type, six.binary_type])
 assert (type(challenge) in [six.text_type, six.binary_type])
 if (type(key) == six.text_type):
  key = key.encode('utf8')
 if (type(challenge) == six.text_type):
  challenge = challenge.encode('utf8')
 sig = hmac.new(key, challenge, hashlib.sha256).digest()
 return binascii.b2a_base64(sig).strip()

def compute_wcs ( key , challenge ) : assert ( type ( key ) in [ six . text_type , six . binary_type ] ) assert ( type ( challenge ) in [ six . text_type , six . binary_type ] ) if ( type ( key ) == six . text_type ) : key = key . encode ( 'utf8' ) if ( type ( challenge ) == six . text_type ) : challenge = challenge . encode ( 'utf8' ) sig = hmac . new ( key , challenge , hashlib . sha256 ) . digest ( ) return binascii . b2a_base64 ( sig ) . strip ( )
compute an wamp-cra authentication signature from an authentication challenge and a key .