| 99 | } |
| 100 | |
| 101 | int decodedLength(int codeLength) noexcept { |
| 102 | const auto r = (codeLength & 3); |
| 103 | if (r == 1) |
| 104 | return -1; |
| 105 | else if (r == 0) |
| 106 | return (codeLength / 4) * 3; |
| 107 | else |
| 108 | return (codeLength / 4) * 3 + (r - 1); |
| 109 | } |
| 110 | |
| 111 | Optional<StringRef> decode(Arena& arena, StringRef base64UrlStr) { |
| 112 | auto decodedLen = decodedLength(base64UrlStr.size()); |