private def decodeBase64()

in pan-domain-auth-verification/src/main/scala/com/gu/pandomainauth/service/CookiePayload.scala [41:50]


  private def decodeBase64(text: String): Array[Byte] = Base64.decodeBase64(text.getBytes(UTF_8))

  /**
   * @return `None` if the cookie text is incorrectly formatted (ie not "abc.xyz", with a '.' separator)
   */
  def parse(cookieText: String): Option[CookiePayload] = cookieText match {
    case CookieRegEx(data, sig) if isBase64(data) && isBase64(sig) =>
      Some(CookiePayload(decodeBase64(data), decodeBase64(sig)))
    case _ => None
  }