-module(nx_cid).
-export([from_sx/1, to_string/1, from_string/1, equals/2]).

%% The kernel-side CID wrapper. The host BIF `cid:to_string/1` already
%% produces a canonical CIDv1 (raw codec, sha2-256 multihash) over the
%% deterministic textual form of any term (er-format-value); we expose
%% it under the kernel namespace and add the equality + round-trip
%% helpers the rest of the kernel needs.
%%
%% Naming note: the BIF module is `cid`, so we use `nx_cid` to avoid
%% shadowing. Plans/fed-sx-milestone-1.md §Step 1 spells the file as
%% `cid.erl`; the briefing flags Erlang snippets as illustrative.

from_sx(V) ->
    cid:to_string(V).

to_string(Cid) ->
    Cid.

from_string(S) ->
    S.

equals(A, B) ->
    A =:= B.
