macula_record (macula v11.4.0)

View Source

Records in the signed-object format of DESIGN_PQ_SIGNED_FRAMES_AND_RECORDS.md.

A record is the signed object {key, tbs, signature} under the label MACULA-PQ-RECORD-V1. Its tbs holds type, alg, version, created_at, expires_at and payload, and subject only on a domain type (tags 0x20 to 0xFF). A constructor returns an unsigned record. sign/2 takes the signer's key, refuses a key whose purpose does not fit the type, and adds key, key_id, alg, tbs and signature. verify/2,3 reads a record in the design's order and keeps its tbs bytes, so encode/1 sends them unchanged.

A record is named by the key id of its key: the node_id for node records, procedure advertisements, content announcements and station endpoints, and the MACULA-KEY-ID-V1 key id for realm, org and foundation records and for every domain type. A tombstone is named as the type it withdraws. A node record is stored under its node_id, and every other record under SHA-256 over MACULA-PQ-STORAGE-KEY-V1, a zero byte, the type and the type's fields.

A procedure advertisement carries its provider authorization inside its payload. verify/2,3 treats it as opaque, so a station that stores records never parses it; verify_authorization/3 is the caller's check.

Summary

Types

The realm trust a provider authorization is checked against: the caller's crypto profile, and either the carried realm key it pins for one realm, or the foundation realm trust list's pairs of realm id to realm key id, for the advertisement's realm.

One entry of a foundation realm trust list: a realm id paired with the realm key id that signs the realm's records (DESIGN_PQ_SIGNED_FRAMES_AND_RECORDS.md, Foundation realm trust list).

Functions

A node's announcement, signed by the node, that it shares the content with this tag 2 content id.

The storage key of a content id's announcements.

Check an unsigned domain record before a pool signs it as its node: a domain type, a payload map, a subject that is absent or a non-empty binary, a lifetime that runs forward and fits the type's maximum, never shortened, and a payload and subject of at most 256 KiB together that nest at most 63 levels. Returns the refusal by name.

Whether a record is of a domain type (tags 0x20 to 0xFF): its owner sets its payload rules, and its slot is its signer's key id, with its subject when it has one.

The wire form of a signed or verified record: its {key, tbs, signature} map, tbs unchanged.

An unsigned record of a domain type (tags 0x20 to 0xFF). The subject_id option names the record's subject, a non-empty binary: an empty subject would name a slot apart from no subject.

A foundation parameter, signed by a foundation key.

A foundation's list of trusted realms: each entry pairs a realm id with the realm key id that signs the realm's records, signed by a foundation key. Its payload holds exactly realms_trusted (D28).

The storage key of a foundation's realm trust list, from the foundation key id. The station computes it to fetch the list without holding its record.

A foundation's seed list, signed by a foundation key.

A foundation's tier 3 attestation of a station, signed by a foundation key.

The longest window a realm member endorsement may have, valid_from to valid_until, in milliseconds: 30 days. Its builder refuses a longer one, and macula_hyparview_endorsement:verify_endorsement/3 refuses one it receives.

A node record about the node NodeId, which signs it.

Whether a node signs this record about itself: a node record, a procedure advertisement or a content announcement, whose payload names the signing node. A tombstone is not one: it withdraws a record, and whoever signs it checks that the record was theirs.

A realm's statement, signed by the realm key, that the org OrgName is held by the key with key id OrgKeyId.

The storage key of an org directory record, from the realm id and the org name.

Check a payload before anything is encoded: its external size is at most 256 KiB, and it nests at most 63 levels of maps and lists, which a record's tbs leaves it under the decoder's 64. Returns record_too_large or malformed.

A payload field, read whatever key form it arrived in: {text, Name}, the binary, or an existing atom. A text value is returned as its binary.

A provider's advertisement of a procedure in a realm, signed by the provider. For a procedure with an org namespace the authorization option carries the provider authorization: org_directory and procedure_delegation as the records' wire form, the only authorization form. The builder refuses any other.

An org's grant, signed by its org key, that the node Advertiser may serve procedures under the org.

The storage key of a procedure delegation, from the org key id and the advertiser's node_id.

The storage key of a procedure's advertisements, from the realm id and the procedure name.

A procedure's org namespace: the text before the first "/" of its name, when there is one and it is not "_".

The trusted realms of a foundation realm trust list, as realm id to realm key id (D28).

A realm's directory record, signed by the realm key: its name and the key id of its admin key.

A realm's statement, signed by the realm key, that a node is a member with roles. Its window, valid_from to valid_until, is at most 30 days and never ends before it starts: a longer one raises a badmatch on {error, endorsement_window_too_long}, and a reversed one on {error, endorsement_window_reversed}.

The stations serving a realm, signed by the realm key.

The record with a new version, created now, with the same lifetime, signed again with Key.

Sign a record with a key whose purpose fits its type. Raises key_purpose_mismatch for a key of another purpose, key_id_mismatch when the payload names a signer other than this key, {malformed, Type} for a record whose fields, subject or payload verify/3 would refuse, and record_too_large past 256 KiB. The field and payload checks are verify/3's own, run before anything is signed, so sign/2 never returns a record verify/3 refuses apart from the clock.

signer_entry/4 at the current time.

The entry one signer holds among the entries a lookup of a slot returns, as wire forms or {key, tbs, signature} maps. Expected is {key_id, Id} for a key named by its MACULA-KEY-ID-V1 key id, or {node_id, Id} for an identity key. Every entry is read as far as its carried key, whatever the answer's order or length, and no signature is checked to select. Only the entries under the expected key are verified: highest claimed version first, stopping at the first that verifies and names Id as its key_id, and at most 4. So an entry under another key costs no verify, and forged entries under the expected key cost a bounded few. The outcome is that record, not_found when no entry is under the key, or the refusal of the last entry verified. The stats count the entries under the key, the entries verified, and the entries past the 80 a slot holds, which a station that keeps to its slot places never sends.

A station's dialable endpoint, signed by the station and stored under its node_id.

The storage key of a station's endpoint record, from the station's node_id.

The 32-byte DHT storage key of a record. A record stored under its signer needs its key_id, so it must be signed or verified; a record named by its payload does not.

A tombstone that withdraws a record: it names the record's type, version and slot fields, takes the record's slot, and lives until the record has expired plus the clock tolerance, so no replica serves the record again after the tombstone lapses. Sign it with the key that signed the record.

The procedure advertisement type tag, for callers that look records up by type.

Verify a record, given as its wire form or as its {key, tbs, signature} map, under the verifier's profile and clock. Refusals are returned, never raised.

The caller's check of a verified advertisement's provider authorization, against the realm trust it holds: the realm-signed org directory and the org-signed procedure delegation, the only authorization form. The realm key is the carried realm key the caller pins, or the realm key id the foundation realm trust list's pairs name for the advertisement's realm_id (D28). A procedure with an org namespace needs an authorization for that org, a procedure without one carries none, and the advertisement expires no later than any part of its authorization. An authorization in any other form, a certificate chain included, is refused as authorization_form_unsupported: 11.0.0 has no certificate form.

Check a record given as its wire form, or as a signed map, before it is decoded or encoded: a wire form is a binary of at most 256 KiB, and a signed map's key, tbs and signature are binaries of at most 256 KiB together. Returns record_too_large or malformed.

Types

authorization/0

-type authorization() :: #{org_directory := binary(), procedure_delegation := binary()}.

The realm trust a provider authorization is checked against: the caller's crypto profile, and either the carried realm key it pins for one realm, or the foundation realm trust list's pairs of realm id to realm key id, for the advertisement's realm.

authorization_refusal/0

-type authorization_refusal() ::
          malformed | no_authorization | authorization_not_allowed | authorization_form_unsupported |
          no_realm_key | org_directory_invalid | org_directory_wrong_realm | org_directory_wrong_org |
          delegation_invalid | delegation_mismatch | authorization_outlived.

content_announcement_opts/0

-type content_announcement_opts() ::
          #{name => binary(),
            size => non_neg_integer(),
            chunk_count => non_neg_integer(),
            ttl_ms => pos_integer()}.

foundation_parameter_opts/0

-type foundation_parameter_opts() ::
          #{valid_from => pos_integer(),
            valid_until => pos_integer(),
            prior_version => version(),
            ttl_ms => pos_integer()}.

One entry of a foundation realm trust list: a realm id paired with the realm key id that signs the realm's records (DESIGN_PQ_SIGNED_FRAMES_AND_RECORDS.md, Foundation realm trust list).

foundation_parameter_value/0

-type foundation_parameter_value() :: integer() | binary() | [integer() | binary()].

foundation_realm_trust_list_entry/0

-type foundation_realm_trust_list_entry() :: #{realm_id := <<_:256>>, realm_key_id := <<_:256>>}.

foundation_realm_trust_list_opts/0

-type foundation_realm_trust_list_opts() :: #{ttl_ms => pos_integer()}.

foundation_seed/0

-type foundation_seed() :: #{node_id := <<_:256>>, addresses := [map()], tier := 3 | 4}.

foundation_seed_list_opts/0

-type foundation_seed_list_opts() ::
          #{valid_from => pos_integer(), valid_until => pos_integer(), ttl_ms => pos_integer()}.

foundation_t3_attestation_opts/0

-type foundation_t3_attestation_opts() ::
          #{valid_until => pos_integer(), notes => binary(), ttl_ms => pos_integer()}.

m_record/0

-type m_record() ::
          #{type := type_tag(),
            version := version(),
            created_at := non_neg_integer(),
            expires_at := non_neg_integer(),
            payload := map(),
            subject => binary(),
            key => binary(),
            key_id => <<_:256>>,
            alg => binary(),
            tbs => binary(),
            signature => binary()}.

node_record_opts/0

-type node_record_opts() ::
          #{station_id => <<_:256>>,
            caps_hint => binary(),
            display_name => binary(),
            ttl_ms => pos_integer(),
            hostname => binary(),
            endpoint => binary(),
            city => binary(),
            country => binary(),
            lat => float() | integer(),
            lng => float() | integer(),
            kind => binary(),
            peers => [<<_:256>>]}.

procedure_advertisement_opts/0

-type procedure_advertisement_opts() :: #{authorization => map(), ttl_ms => pos_integer()}.

realm_directory_opts/0

-type realm_directory_opts() :: #{policy_url => binary(), ttl_ms => pos_integer()}.

realm_member_endorsement_opts/0

-type realm_member_endorsement_opts() ::
          #{valid_from => pos_integer(), valid_until => pos_integer(), ttl_ms => pos_integer()}.

realm_station_entry/0

-type realm_station_entry() :: #{station_id := <<_:256>>, roles := [binary()]}.

realm_stations_opts/0

-type realm_stations_opts() :: #{ttl_ms => pos_integer()}.

reason/0

-type reason() :: shutdown | moved | revoked.

refusal/0

-type refusal() ::
          record_too_large | malformed | signature_invalid | alg_mismatch | not_yet_valid | expired |
          key_id_mismatch | lifetime_too_long | lifetime_reversed.

signer_entry_stats/0

-type signer_entry_stats() ::
          #{matching := non_neg_integer(),
            verified := non_neg_integer(),
            beyond_capacity := non_neg_integer()}.

station_endpoint_opts/0

-type station_endpoint_opts() ::
          #{host_advertised => [binary()], alpn => binary(), ttl_ms => pos_integer()}.

tombstone_opts/0

-type tombstone_opts() :: #{detail => binary(), ttl_ms => pos_integer()}.

trust/0

-type trust() ::
          #{profile := macula_crypto_profile:profile(),
            realm_key => binary(),
            realm_pairs => #{<<_:256>> => <<_:256>>}}.

type_tag/0

-type type_tag() :: 1..255.

version/0

-type version() :: <<_:128>>.

Functions

content_announcement(AnnouncerNode, MCID, Endpoint)

-spec content_announcement(<<_:256>>, <<_:400>>, binary()) -> m_record().

A node's announcement, signed by the node, that it shares the content with this tag 2 content id.

content_announcement(AnnouncerNode, MCID, Endpoint, Opts)

-spec content_announcement(<<_:256>>, <<_:400>>, binary(), content_announcement_opts()) -> m_record().

content_key(MCID)

-spec content_key(<<_:400>>) -> <<_:256>>.

The storage key of a content id's announcements.

created_at(_)

-spec created_at(m_record()) -> non_neg_integer().

domain_record_checked(Record)

-spec domain_record_checked(term()) ->
                               ok |
                               {error,
                                not_a_domain_type | invalid_subject | lifetime_too_long |
                                lifetime_reversed | record_too_large | malformed}.

Check an unsigned domain record before a pool signs it as its node: a domain type, a payload map, a subject that is absent or a non-empty binary, a lifetime that runs forward and fits the type's maximum, never shortened, and a payload and subject of at most 256 KiB together that nest at most 63 levels. Returns the refusal by name.

domain_type(Other)

-spec domain_type(term()) -> boolean().

Whether a record is of a domain type (tags 0x20 to 0xFF): its owner sets its payload rules, and its slot is its signer's key id, with its subject when it has one.

encode(_)

-spec encode(m_record()) -> binary().

The wire form of a signed or verified record: its {key, tbs, signature} map, tbs unchanged.

envelope(Type, Payload, Opts)

-spec envelope(type_tag(), map(), map()) -> m_record().

An unsigned record of a domain type (tags 0x20 to 0xFF). The subject_id option names the record's subject, a non-empty binary: an empty subject would name a slot apart from no subject.

expires_at(_)

-spec expires_at(m_record()) -> non_neg_integer().

foundation_parameter(Name, Value)

-spec foundation_parameter(binary(), foundation_parameter_value()) -> m_record().

A foundation parameter, signed by a foundation key.

foundation_parameter(Name, Value, Opts)

-spec foundation_parameter(binary(), foundation_parameter_value(), foundation_parameter_opts()) ->
                              m_record().

foundation_realm_trust_list(Trusted)

-spec foundation_realm_trust_list([foundation_realm_trust_list_entry()]) -> m_record().

A foundation's list of trusted realms: each entry pairs a realm id with the realm key id that signs the realm's records, signed by a foundation key. Its payload holds exactly realms_trusted (D28).

foundation_realm_trust_list(Trusted, Opts)

-spec foundation_realm_trust_list([foundation_realm_trust_list_entry()],
                                  foundation_realm_trust_list_opts()) ->
                                     m_record().

foundation_realm_trust_list_key(FoundationKeyId)

-spec foundation_realm_trust_list_key(<<_:256>>) -> <<_:256>>.

The storage key of a foundation's realm trust list, from the foundation key id. The station computes it to fetch the list without holding its record.

foundation_seed_list(Seeds)

-spec foundation_seed_list([foundation_seed()]) -> m_record().

A foundation's seed list, signed by a foundation key.

foundation_seed_list(Seeds, Opts)

-spec foundation_seed_list([foundation_seed()], foundation_seed_list_opts()) -> m_record().

foundation_t3_attestation(StationId, AuditDate)

-spec foundation_t3_attestation(<<_:256>>, pos_integer()) -> m_record().

A foundation's tier 3 attestation of a station, signed by a foundation key.

foundation_t3_attestation(StationId, AuditDate, Opts)

-spec foundation_t3_attestation(<<_:256>>, pos_integer(), foundation_t3_attestation_opts()) ->
                                   m_record().

key(_)

-spec key(m_record()) -> binary().

key_id(_)

-spec key_id(m_record()) -> <<_:256>>.

max_endorsement_window_ms()

-spec max_endorsement_window_ms() -> pos_integer().

The longest window a realm member endorsement may have, valid_from to valid_until, in milliseconds: 30 days. Its builder refuses a longer one, and macula_hyparview_endorsement:verify_endorsement/3 refuses one it receives.

node_record(NodeId, Realms, Capabilities)

-spec node_record(<<_:256>>, [<<_:256>>], non_neg_integer()) -> m_record().

A node record about the node NodeId, which signs it.

node_record(NodeId, Realms, Capabilities, Opts)

-spec node_record(<<_:256>>, [<<_:256>>], non_neg_integer(), node_record_opts()) -> m_record().

node_signed(NotARecord)

-spec node_signed(term()) -> boolean().

Whether a node signs this record about itself: a node record, a procedure advertisement or a content announcement, whose payload names the signing node. A tombstone is not one: it withdraws a record, and whoever signs it checks that the record was theirs.

org_directory(RealmId, OrgName, OrgKeyId)

-spec org_directory(<<_:256>>, binary(), <<_:256>>) -> m_record().

A realm's statement, signed by the realm key, that the org OrgName is held by the key with key id OrgKeyId.

org_directory(RealmId, OrgName, OrgKeyId, Opts)

-spec org_directory(<<_:256>>, binary(), <<_:256>>, map()) -> m_record().

org_directory_key(RealmId, OrgName)

-spec org_directory_key(<<_:256>>, binary()) -> <<_:256>>.

The storage key of an org directory record, from the realm id and the org name.

payload(_)

-spec payload(m_record()) -> map().

payload_bounded(Payload)

-spec payload_bounded(term()) -> ok | {error, record_too_large | malformed}.

Check a payload before anything is encoded: its external size is at most 256 KiB, and it nests at most 63 levels of maps and lists, which a record's tbs leaves it under the decoder's 64. Returns record_too_large or malformed.

payload_field(Payload, Name)

-spec payload_field(map(), binary()) -> term().

A payload field, read whatever key form it arrived in: {text, Name}, the binary, or an existing atom. A text value is returned as its binary.

procedure_advertisement(AdvertiserNode, RealmId, Procedure, ServingStation)

-spec procedure_advertisement(<<_:256>>, <<_:256>>, binary(), <<_:256>>) -> m_record().

A provider's advertisement of a procedure in a realm, signed by the provider. For a procedure with an org namespace the authorization option carries the provider authorization: org_directory and procedure_delegation as the records' wire form, the only authorization form. The builder refuses any other.

procedure_advertisement(AdvertiserNode, RealmId, Procedure, ServingStation, Opts)

-spec procedure_advertisement(<<_:256>>, <<_:256>>, binary(), <<_:256>>, procedure_advertisement_opts()) ->
                                 m_record().

procedure_delegation(OrgKeyId, Advertiser)

-spec procedure_delegation(<<_:256>>, <<_:256>>) -> m_record().

An org's grant, signed by its org key, that the node Advertiser may serve procedures under the org.

procedure_delegation(OrgKeyId, Advertiser, Opts)

-spec procedure_delegation(<<_:256>>, <<_:256>>, map()) -> m_record().

procedure_delegation_key(OrgKeyId, Advertiser)

-spec procedure_delegation_key(<<_:256>>, <<_:256>>) -> <<_:256>>.

The storage key of a procedure delegation, from the org key id and the advertiser's node_id.

procedure_key(RealmId, Procedure)

-spec procedure_key(<<_:256>>, binary()) -> <<_:256>>.

The storage key of a procedure's advertisements, from the realm id and the procedure name.

procedure_org(Procedure)

-spec procedure_org(binary()) -> {org, binary()} | none | {error, malformed}.

A procedure's org namespace: the text before the first "/" of its name, when there is one and it is not "_".

read_content_announcement(_)

-spec read_content_announcement(m_record()) -> map().

read_foundation_realm_trust_list(_)

-spec read_foundation_realm_trust_list(m_record()) -> #{<<_:256>> => <<_:256>>}.

The trusted realms of a foundation realm trust list, as realm id to realm key id (D28).

read_node_record(_)

-spec read_node_record(m_record()) -> map().

read_org_directory(_)

-spec read_org_directory(m_record()) ->
                            #{realm_id := <<_:256>>, org_name := binary(), org_key := <<_:256>>}.

read_procedure_advertisement(_)

-spec read_procedure_advertisement(m_record()) -> map().

read_procedure_delegation(_)

-spec read_procedure_delegation(m_record()) -> #{org_key := <<_:256>>, advertiser := <<_:256>>}.

read_station_endpoint(_)

-spec read_station_endpoint(m_record()) -> #{quic_port := 1..65535, host_advertised := [binary()]}.

read_tombstone(_)

-spec read_tombstone(m_record()) -> map().

realm_directory(RealmId, Name, AdminKeyId)

-spec realm_directory(<<_:256>>, binary(), <<_:256>>) -> m_record().

A realm's directory record, signed by the realm key: its name and the key id of its admin key.

realm_directory(RealmId, Name, AdminKeyId, Opts)

-spec realm_directory(<<_:256>>, binary(), <<_:256>>, realm_directory_opts()) -> m_record().

realm_member_endorsement(RealmId, Spec)

-spec realm_member_endorsement(<<_:256>>,
                               #{realm := <<_:256>>, member_node := <<_:256>>, roles := [binary()]}) ->
                                  m_record().

A realm's statement, signed by the realm key, that a node is a member with roles. Its window, valid_from to valid_until, is at most 30 days and never ends before it starts: a longer one raises a badmatch on {error, endorsement_window_too_long}, and a reversed one on {error, endorsement_window_reversed}.

realm_member_endorsement(RealmId, _, Opts)

-spec realm_member_endorsement(<<_:256>>,
                               #{realm := <<_:256>>, member_node := <<_:256>>, roles := [binary()]},
                               realm_member_endorsement_opts()) ->
                                  m_record().

realm_stations(RealmId, Entries)

-spec realm_stations(<<_:256>>, [realm_station_entry()]) -> m_record().

The stations serving a realm, signed by the realm key.

realm_stations(RealmId, Entries, Opts)

-spec realm_stations(<<_:256>>, [realm_station_entry()], realm_stations_opts()) -> m_record().

refresh(Record, Key)

-spec refresh(m_record(), macula_node_keys:node_key()) -> m_record().

The record with a new version, created now, with the same lifetime, signed again with Key.

sign(Record, Key)

Sign a record with a key whose purpose fits its type. Raises key_purpose_mismatch for a key of another purpose, key_id_mismatch when the payload names a signer other than this key, {malformed, Type} for a record whose fields, subject or payload verify/3 would refuse, and record_too_large past 256 KiB. The field and payload checks are verify/3's own, run before anything is signed, so sign/2 never returns a record verify/3 refuses apart from the clock.

signature(_)

-spec signature(m_record()) -> binary().

signer_entry(Entries, Expected, Profile)

-spec signer_entry([binary() | map()], {key_id | node_id, <<_:256>>}, macula_crypto_profile:profile()) ->
                      {{ok, m_record()} | {error, not_found | refusal()}, signer_entry_stats()}.

signer_entry/4 at the current time.

signer_entry(Entries, _, Profile, Now)

-spec signer_entry([binary() | map()],
                   {key_id | node_id, <<_:256>>},
                   macula_crypto_profile:profile(),
                   integer()) ->
                      {{ok, m_record()} | {error, not_found | refusal()}, signer_entry_stats()}.

The entry one signer holds among the entries a lookup of a slot returns, as wire forms or {key, tbs, signature} maps. Expected is {key_id, Id} for a key named by its MACULA-KEY-ID-V1 key id, or {node_id, Id} for an identity key. Every entry is read as far as its carried key, whatever the answer's order or length, and no signature is checked to select. Only the entries under the expected key are verified: highest claimed version first, stopping at the first that verifies and names Id as its key_id, and at most 4. So an entry under another key costs no verify, and forged entries under the expected key cost a bounded few. The outcome is that record, not_found when no entry is under the key, or the refusal of the last entry verified. The stats count the entries under the key, the entries verified, and the entries past the 80 a slot holds, which a station that keeps to its slot places never sends.

station_endpoint(QuicPort)

-spec station_endpoint(1..65535) -> m_record().

A station's dialable endpoint, signed by the station and stored under its node_id.

station_endpoint(QuicPort, Opts)

-spec station_endpoint(1..65535, station_endpoint_opts()) -> m_record().

station_endpoint_key(NodeId)

-spec station_endpoint_key(<<_:256>>) -> <<_:256>>.

The storage key of a station's endpoint record, from the station's node_id.

storage_key(Record)

-spec storage_key(m_record()) -> <<_:256>>.

The 32-byte DHT storage key of a record. A record stored under its signer needs its key_id, so it must be signed or verified; a record named by its payload does not.

tombstone(Withdrawn, Reason)

-spec tombstone(m_record(), reason()) -> m_record().

A tombstone that withdraws a record: it names the record's type, version and slot fields, takes the record's slot, and lives until the record has expired plus the clock tolerance, so no replica serves the record again after the tombstone lapses. Sign it with the key that signed the record.

tombstone(Withdrawn, Reason, Opts)

-spec tombstone(m_record(), reason(), tombstone_opts()) -> m_record().

type(_)

-spec type(m_record()) -> type_tag().

type_procedure_advertisement()

-spec type_procedure_advertisement() -> type_tag().

The procedure advertisement type tag, for callers that look records up by type.

verify(Signed, Profile)

-spec verify(binary() | map(), macula_crypto_profile:profile()) -> {ok, m_record()} | {error, refusal()}.

Verify a record, given as its wire form or as its {key, tbs, signature} map, under the verifier's profile and clock. Refusals are returned, never raised.

verify(Bytes, Profile, Now)

-spec verify(binary() | map(), macula_crypto_profile:profile(), integer()) ->
                {ok, m_record()} | {error, refusal()}.

verify_authorization(Advertisement, Trust, Now)

-spec verify_authorization(m_record(), trust(), integer()) -> ok | {error, authorization_refusal()}.

The caller's check of a verified advertisement's provider authorization, against the realm trust it holds: the realm-signed org directory and the org-signed procedure delegation, the only authorization form. The realm key is the carried realm key the caller pins, or the realm key id the foundation realm trust list's pairs name for the advertisement's realm_id (D28). A procedure with an org namespace needs an authorization for that org, a procedure without one carries none, and the advertisement expires no later than any part of its authorization. An authorization in any other form, a certificate chain included, is refused as authorization_form_unsupported: 11.0.0 has no certificate form.

version(_)

-spec version(m_record()) -> version().

wire_bounded(Bytes)

-spec wire_bounded(term()) -> ok | {error, record_too_large | malformed}.

Check a record given as its wire form, or as a signed map, before it is decoded or encoded: a wire form is a binary of at most 256 KiB, and a signed map's key, tbs and signature are binaries of at most 256 KiB together. Returns record_too_large or malformed.