Module didkit::c

source ·

Statics

  • The version of the DIDKit library, as a NULL-terminated string

Functions

  • Issue a Verifiable Presentation for DIDAuth. Input parameters are the holder URI as a C string, and JSON C strings for the linked data proof options and the JWK for signing. On success, a newly-issued verifiable presentation is returned as a newly-allocated C string. The returned string should be freed using didkit_free_string. On failure, NULL is returned, and the error message can be retrieved using didkit_error_message.
  • Resolve a DID to a DID Document. Arguments are a C string containing the DID to resolve, and a C string containing a JSON object for resolution input metadata. The return value on success is a newly-allocated C string containing either the resolved DID document or a DID resolution result JSON object. On error, NULL is returned, and the error can be retrieved using didkit_error_message.
  • Resolve a DID to a DID Document. Arguments are a C string containing the DID URL to dereference, and a C string containing a JSON object for dereferencing input metadata. The return value on success is a newly-allocated C string containing either a resolved resource or a DID resolution result JSON object. On error, NULL is returned, and the error can be retrieved using didkit_error_message.
  • Free a C string that has been dynamically allocated by DIDKit. This should be used for strings returned from most DIDKit C functions, per their respective documentation.
  • Get the version of the DIDKit library. Returns a static C string which should not be mutated or freed.
  • Convert a key in JWK format to a did:key DID. Input should be a JWK containing public key parameters. Private key parameters in the JWK are ignored. On success, returns a newly-allocated C string containing a DID corresponding to the JWK. The returned string must be freed with didkit_free_string. On failure, returns NULL; the error message can be retrieved with didkit_error_message.
  • Convert a key to a did:key DID URI for use in the verificationMethod property of a linked data proof. Input should be a C string containing the key as a JWK. The JWK should contain public key material; private key parameters are ignored. On success, this function returns a newly-allocated C string containing the verificationMethod URI. On failure, NULL is returned; the error message can be retrieved using didkit_error_message.
  • Generate a new Ed25519 keypair in JWK format. On success, returns a pointer to a newly-allocated string containing the JWK. The string must be freed with didkit_free_string. On failure, returns NULL; the error message can be retrieved with didkit_error_message.
  • Issue a Verifiable Credential. Input parameters are JSON C strings for the unsigned credential to be issued, the linked data proof options, and the JWK for signing. On success, the newly-issued verifiable credential is returned as a newly-allocated C string. The returned string should be freed using didkit_free_string. On failure, NULL is returned, and the error message can be retrieved using didkit_error_message.
  • Issue a Verifiable Presentation. Input parameters are JSON C strings for the unsigned presentation to be issued, the linked data proof options, and the JWK for signing. On success, the newly-issued verifiable presentation is returned as a newly-allocated C string. The returned string should be freed using didkit_free_string. On failure, NULL is returned, and the error message can be retrieved using didkit_error_message.
  • Verify a Verifiable Credential. Arguments are a C string containing the Verifiable Credential to verify, and a C string containing a JSON object for the linked data proof options for verification. The return value is a newly-allocated C string containing a JSON object for the verification result, or NULL in case of certain errors. On successful verification, the verification result JSON object contains a “errors” property whose value is an empty array. If verification fails, either NULL is returned and the error can be retrieved using didkit_error_message, or a verification result JSON object is returned with an “errors” array containing information about the verification error(s) encountered. A string returned from this function should be freed using didkit_free_string.
  • Verify a Verifiable Presentation. Arguments are a C string containing the Verifiable Presentation to verify, and a C string containing a JSON object for the linked data proof options for verification. The return value is a newly-allocated C string containing a JSON object for the verification result, or NULL in case of certain errors. On successful verification, the verification result JSON object contains a “errors” property whose value is an empty array. If verification fails, either NULL is returned and the error can be retrieved using didkit_error_message, or a verification result JSON object is returned with an “errors” array containing information about the verification error(s) encountered. A string returned from this function should be freed using didkit_free_string.