# `Cryppo.EncryptionKey`
[🔗](https://github.com/leikind/cryppo_ex/blob/main/lib/cryppo/encryption_key.ex#L1)

A struct to wrap an encryption key

An `EncryptionKey` struct may be marked as belonging to a certain encryption strategy
using field `encryption_strategy_module` containing the module of the encryption strategy.

Depending on the encryption strategy the key can be a binary or a tuple.

Keys must be guarded and protected, that is why the `Inspect` protocol has been
overridden for this struct to disable pretty-printing.

Should you need to access the key, access it via field `key`.

# `binary_key`

```elixir
@type binary_key() :: binary()
```

A binary key

# `internal_key`

```elixir
@type internal_key() :: binary_key() | tuple()
```

Encryption key

An encryption key may me a tuple or a binary depending on the encryption strategy

# `t`

```elixir
@type t() :: %Cryppo.EncryptionKey{
  encryption_strategy_module: Cryppo.encryption_strategy_module(),
  key: internal_key()
}
```

Struct EncryptionKey

A `Cryppo.EncryptionKey` struct contains

* `key`: the key itself
* `encryption_strategy_module`: module of the encryption strategy to which the key belongs

# `new`

```elixir
@spec new(internal_key()) :: t()
```

Initialize a struct with an encryption key

# `new`

```elixir
@spec new(internal_key(), Cryppo.encryption_strategy_module()) :: t()
```

Initialize a struct with  an encryption key and the module of an encryption strategy

---

*Consult [api-reference.md](api-reference.md) for complete listing*
