nl_tokens: Validate and decode the user context served to an app using the Optimizely Canvas . testing_tools / common / utils . py
pl_tokens: function ( clientSecret , signedRequest ) { var signedRequestParts = signedRequest . split ( '.' ) ; var hashedContext = signedRequestParts [ 0 ] , unhashedContext = signedRequestParts [ 1 ] ; var rehashedContext = new Buffer ( crypto . createHmac ( CANVAS_HMAC_ALGORITHM , clientSecret ) . <mask> ( unhashedContext ) . digest ( 'hex' ) ) . toString ( 'base64' ) ; if ( rehashedContext !== hashedContext ) { throw Error ( 'Request not properly signed.' ) } return JSON . parse ( new Buffer ( unhashedContext , 'base64' ) ) ; }