ExIcaoVds.TrustResolvers.DatabaseStore
(ex_icao_vds v0.3.2)
Copy Markdown
Trust resolver backed by an Ecto repo.
The caller provides an Ecto repo and schema module. The schema is queried by signer identifier and key reference to return the public key bytes and curve.
Config opts
| Key | Default | Description |
|---|---|---|
:repo | — | Ecto repo module (required) |
:schema | — | Ecto schema module (required) |
:signer_identifier_field | :signer_identifier | Schema field name for signer ID |
:key_reference_field | :key_reference | Schema field name for key reference |
:public_key_field | :public_key | Schema field name for public key binary |
:curve_field | :curve | Schema field name for curve atom/string |
:default_curve | :secp256r1 | Curve to use when :curve_field is nil |
Example schema
defmodule MyApp.TrustedSigner do
use Ecto.Schema
schema "trusted_signers" do
field :signer_identifier, :string
field :key_reference, :string
field :public_key, :binary
field :curve, :string, default: "secp256r1"
end
endUsage
ExIcaoVds.verify(raw_vds, %{
verifier: %{
trust_resolver: ExIcaoVds.TrustResolvers.DatabaseStore,
repo: MyApp.Repo,
schema: MyApp.TrustedSigner
}
})