Skip to content

Commit

Permalink
Adding host support for json schemas in claims (#645)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Hoffman <autodidaddict@users.noreply.github.com>
  • Loading branch information
autodidaddict authored Jul 24, 2023
1 parent 4879642 commit 1e9076a
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 46 deletions.
16 changes: 12 additions & 4 deletions host_core/lib/host_core/claims/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ defmodule HostCore.Claims.Manager do
tags: String.t(),
version: String.t(),
sub: String.t(),
contract_id: String.t() | nil
contract_id: String.t() | nil,
config_schema: String.t() | nil
}

@spec lookup_claims(lattice_prefix :: String.t(), public_key :: String.t()) ::
Expand Down Expand Up @@ -51,7 +52,7 @@ defmodule HostCore.Claims.Manager do
def put_claims(host_id, lattice_prefix, claims) do
public_key = claims.public_key

claims = %{
newclaims = %{
call_alias:
if claims.call_alias == nil do
""
Expand Down Expand Up @@ -88,8 +89,15 @@ defmodule HostCore.Claims.Manager do
contract_id: Map.get(claims, :contract_id) || ""
}

cache_claims(lattice_prefix, public_key, claims)
publish_claims(host_id, lattice_prefix, claims)
newclaims =
if claims.config_schema != nil do
Map.put(newclaims, :config_schema, claims.config_schema)
else
newclaims
end

cache_claims(lattice_prefix, public_key, newclaims)
publish_claims(host_id, lattice_prefix, newclaims)
end

def claims_table_atom(lattice_prefix) do
Expand Down
104 changes: 64 additions & 40 deletions host_core/native/hostcore_wasmcloud_native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e9076a

Please sign in to comment.