B2G/gecko/services/aitc/modules/manager.js
// Extract the email address from a BrowserID assertion.
Extract the email address from a BrowserID assertion.
Extract the email address from a BrowserID assertion .
function _extractEmail(assertion) {
    let chain = assertion.split("~");
    let len = chain.length;
    if (len < 2) {
      return null;
    }
    try {
      let cert = JSON.parse(atob(
        chain[0].split(".")[1].replace("-", "+", "g").replace("_", "/", "g")
      ));
      return cert.principal.email;
    } catch (e) {
      return null;
    }
  }
function _extractEmail ( assertion ) { let chain = assertion . split ( "~" ) ; let len = chain . length ; if ( len < 2 ) { return null ; } try { let cert = JSON . parse ( atob ( chain [ 0 ] . split ( "." ) [ 1 ] . replace ( "-" , "+" , "g" ) . replace ( "_" , "/" , "g" ) ) ) ; return cert . principal . email ; } catch ( e ) { return null ; } }
Extract the email address from a BrowserID assertion.
Extract the email address from a BrowserID assertion .
// Please look the other way while I do this. Thanks. // We need CommonUtils.decodeBase64URL.