secure_server v0.1.0 SecureServer

SecureServer provides the encoder and decoder for secure Phoenix web servers.

While not all the functions defined here are used in Phoenix or Plug, they are important to have to implement a ‘complete’ encoder/decoder.

The encoding and decoding functions in this file MUST match those in :secure_client, or else they will not be able to communicate.

Summary

Functions

Decodes any encrypted, base64 encoded binary into a valid elixir structure

Decodes any encrypted, base64 encoded binary into a valid elixir structure

Encodes any valid elixir structure as an encrypted, base64 encoded binary

Encodes any valid elixir structure as an encrypted, base64 encoded binary

Calls encode/1. Since the data ends up encoded with base64, the iodata is the same as the binary

Calls encode!/1. Since the data ends up encoded with base64, the iodata is the same as the binary

Types

decoded :: map | struct | list
encoded :: binary
safe_decoded :: {:ok, decoded} | {:error, any}
safe_encoded :: {:ok, encoded} | {:error, any}

Functions

decode(data)

Specs

decode(encoded) :: safe_decoded

Decodes any encrypted, base64 encoded binary into a valid elixir structure.

decode!(data)

Specs

decode!(encoded) :: decoded

Decodes any encrypted, base64 encoded binary into a valid elixir structure.

This method is used in Plug.Parsers.ENCRYPTED.

encode(data)

Specs

encode(decoded) :: safe_encoded

Encodes any valid elixir structure as an encrypted, base64 encoded binary.

encode!(data)

Specs

encode!(decoded) :: encoded

Encodes any valid elixir structure as an encrypted, base64 encoded binary.

encode_to_iodata(data)

Specs

encode_to_iodata(decoded) :: safe_encoded

Calls encode/1. Since the data ends up encoded with base64, the iodata is the same as the binary.

encode_to_iodata!(data)

Specs

encode_to_iodata!(decoded) :: encoded

Calls encode!/1. Since the data ends up encoded with base64, the iodata is the same as the binary.

This function is called when rendering encrypted data in Phoenix.