• Converts a multibase identifier to a cryptographic key.

    Parameters

    • params: {
          multibaseKeyId: string;
      }

      The parameters for the conversion.

      • multibaseKeyId: string

        The multibase identifier string of the key.

    Returns Required<KeyWithMulticodec>

    An object containing the key as a Uint8Array and its multicodec code and name.

    Remarks

    This function decodes a multibase identifier back into a cryptographic key. It first decodes the identifier from multibase format into Base58 format, and then converts it into a Uint8Array. Afterward, it removes the multicodec prefix, extracting the raw key data along with the multicodec code and name.

    Example

    const multibaseKeyId = '...'; // Multibase identifier of the key
    const { key, multicodecCode, multicodecName } = multibaseIdToKey({ multibaseKeyId });

    Throws

    DidError if the multibase identifier is invalid.