-- Deploy camper:decode_base64url to pg
-- requires: roles
-- requires: schema_camper

begin;

set search_path to camper, public;

create or replace function decode_base64url(encoded text) returns bytea as
$$
	select decode(translate(encoded, '-_', '+/'), 'base64');
$$
	language sql
	immutable
;

revoke execute on function decode_base64url(text) from public;
grant execute on function decode_base64url(text) to guest;
grant execute on function decode_base64url(text) to employee;
grant execute on function decode_base64url(text) to admin;

commit;
