Re: encode/decode support for base64url

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Florents Tselai <florents.tselai@gmail.com>
Cc: Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Przemysław Sztoch <przemyslaw@sztoch.pl>
Date: 2025-03-10T12:31:51Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add support for base64url encoding and decoding

> On 10 Mar 2025, at 12:28, Florents Tselai <florents.tselai@gmail.com> wrote:

> Here's a C implementation for this, along with some tests and documentation.
> Tests are copied from cpython's implementation of urlsafe_b64encode and urlsafe_b64decode.

+         <function>base64url_encode</function> ( <parameter>input</parameter> <type>bytea</type> )

Shouldn't this be modelled around how base64 works with the encode() and
decode() functions, ie encode('123\001', 'base64')?

	https://www.postgresql.org/docs/devel/functions-binarystring.html

--
Daniel Gustafsson