AgentBlueprintProtocol.Base64Url (Agent Blueprint Protocol v1.1.0)

Copy Markdown View Source

This module encodes and decodes strict unpadded base64url values.

Use it when a protocol field contains URL-safe binary data.

This module does not authorize operations.

Example

encoded = AgentBlueprintProtocol.Base64Url.encode("sample")
{:ok, "sample"} = AgentBlueprintProtocol.Base64Url.decode(encoded)

Summary

Functions

Decodes unpadded base64url text to binary bytes; rejects padding and invalid encodings.

Encodes a binary as unpadded base64url.

Functions

decode(input)

(since 1.0.0)
@spec decode(binary()) :: {:ok, binary()} | {:error, AgentBlueprintProtocol.Error.t()}

Decodes unpadded base64url text to binary bytes; rejects padding and invalid encodings.

Example

iex> AgentBlueprintProtocol.Base64Url.decode("YWJj")
{:ok, "abc"}

encode(data)

(since 1.0.0)
@spec encode(binary()) :: binary() | {:error, AgentBlueprintProtocol.Error.t()}

Encodes a binary as unpadded base64url.

Example

iex> AgentBlueprintProtocol.Base64Url.encode("abc")
"YWJj"