saschpe / Kase64

Base64 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.
Apache License 2.0
30 stars 4 forks source link

base64Decoded adds unexpected characters at end #20

Closed sudansh closed 4 months ago

sudansh commented 6 months ago

Given assert fails

assertEquals( "{\"aud\":\"ae.rain.com\",\"exp\":1713261313,\"iat\":1713259513,\"iss\":\"ae.rain.com\",\"rain:jurisdiction\":\"uae\",\"sub\":\"58490195-01b9-4dcf-ae28-ae0b20f8fbda\"}", "eyJhdWQiOiJhZS5yYWluLmNvbSIsImV4cCI6MTcxMzI2MTMxMywiaWF0IjoxNzEzMjU5NTEzLCJpc3MiOiJhZS5yYWluLmNvbSIsInJhaW46anVyaXNkaWN0aW9uIjoidWFlIiwic3ViIjoiNTg0OTAxOTUtMDFiOS00ZGNmLWFlMjgtYWUwYjIwZjhmYmRhIn0".base64Decoded )

saschpe commented 4 months ago

Try "ey...n0".base64UrlDecoded, that Base64 string is in URL encoding.