Search documentation of macula

# macula_address (macula v4.4.9)

View Source

macula-net address derivation: pubkey -> IPv6.

Per the macula-net spec (PLAN_MACULA_NET.md §3.1):

         addr = 0xfd | blake3(realm_master_pubkey)[0:40 bits]
                     | blake3(identity_pubkey)[0:80 bits]

Uses `macula_blake3_nif:hash/1` for the BLAKE3 primitive — no new NIF; reuses the SDK's existing crypto layer.

### Realm-scoped identity

An "identity" here is a realm-scoped Ed25519 keypair. A user/daemon in N realms holds N realm-scoped keypairs and gets N addresses (one per realm, all unlinkable at L3). See spec §3.6 for the full model.

# Summary

## Types

ipv6_address/0

16-byte IPv6

ipv6_text/0

RFC 5952 lowercase

pubkey/0

32-byte Ed25519 pubkey

## Functions

derive(RealmMasterPubkey, IdentityPubkey)

Derive a macula-net IPv6 address from a realm + identity keypair.

derive_and_format(RealmMasterPubkey, IdentityPubkey)

Convenience: derive + format in one call.

format(_)

Render a 16-byte IPv6 binary as RFC 5952 lowercase text.

# Types

# ipv6_address/0

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

16-byte IPv6

# ipv6_text/0

    -type ipv6_text() :: binary().

RFC 5952 lowercase

# pubkey/0

    -type pubkey() :: <<_:256>>.

32-byte Ed25519 pubkey

# Functions

# derive(RealmMasterPubkey, IdentityPubkey)

    -spec derive(RealmMasterPubkey :: pubkey(), IdentityPubkey :: pubkey()) -> ipv6_address().

Derive a macula-net IPv6 address from a realm + identity keypair.

# derive_and_format(RealmMasterPubkey, IdentityPubkey)

    -spec derive_and_format(pubkey(), pubkey()) -> ipv6_text().

Convenience: derive + format in one call.

# format(_)

    -spec format(ipv6_address()) -> ipv6_text().

Render a 16-byte IPv6 binary as RFC 5952 lowercase text.