Decentralized identifier (DID) helpers for MPP credential sources.
EVM wallet addresses use the did:pkh:eip155 method per CAIP-10.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
parse_evm_did | 1 | Parse a did:pkh:eip155 credential source into chain ID and address. | did: value |
evm_did | 2 | Build a did:pkh:eip155 identifier for an EVM address and chain. | address: value, chain_id: value |
Summary
Functions
Build a did:pkh:eip155 identifier for an EVM address and chain.
Parse a did:pkh:eip155 credential source into chain ID and address.
Functions
Build a did:pkh:eip155 identifier for an EVM address and chain.
Parameters
address- EVM address (e.g., 0x742d35Cc6634c0532925a3b844bC9e7595F8fE00) (value)chain_id- EVM chain ID (e.g., 42431 for Tempo Moderato) (value)
Returns
DID string in did:pkh:eip155:<chain_id>:<address> format (string)
# descripex:contract
%{
params: %{
address: %{
description: "EVM address (e.g., 0x742d35Cc6634c0532925a3b844bC9e7595F8fE00)",
kind: :value
},
chain_id: %{
description: "EVM chain ID (e.g., 42431 for Tempo Moderato)",
kind: :value
}
},
returns: %{
type: :string,
description: "DID string in `did:pkh:eip155:<chain_id>:<address>` format",
example: "did:pkh:eip155:42431:0x742d35Cc6634c0532925a3b844bC9e7595F8fE00"
}
}
@spec parse_evm_did(String.t()) :: {:ok, %{chain_id: non_neg_integer(), address: String.t()}} | {:error, :invalid_did}
Parse a did:pkh:eip155 credential source into chain ID and address.
Parameters
did- DID string (e.g., did:pkh:eip155:42431:0x...) (value)
Returns
{:ok, %{chain_id: int, address: string}} or {:error, :invalid_did} (tagged_tuple)
Composes With
evm_did
# descripex:contract
%{
params: %{
did: %{
description: "DID string (e.g., did:pkh:eip155:42431:0x...)",
kind: :value
}
},
returns: %{
type: :tagged_tuple,
description: "`{:ok, %{chain_id: int, address: string}}` or `{:error, :invalid_did}`"
},
composes_with: [:evm_did]
}