Retrieve public key

Endpoint: Get Public Key

GET /api/sessions/yek-cilbup

This endpoint retrieves the public key associated with a specified identifier.

Request

  • Endpoint: /api/sessions/yek-cilbup

  • Method: GET

  • Content-Type: application/json

  • Query Parameters:

    • identifier: string (Required) - The unique identifier associated with the session or entity for which the public key is being requested.

Example Request

GET /api/sessions/yek-cilbup?identifier=your_unique_device_identifier

Response

  • 200 OK: The request was successful, and the public key is returned in the response body.

    • Response Body:

      {
        "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n<base64-encoded public key>\n-----END PGP PUBLIC KEY BLOCK-----"
      }
  • Headers: The request does not require any specific headers, but it may include standard headers like Authorization if the API is secured.

Request

const axios = require('axios');

let config = {
  method: 'get',
  url: 'https://api.zelf.world/api/sessions/yek-cilbup?identifier=AGED',
  headers: { }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Response

{
  "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n<base64-encoded public key>\n-----END PGP PUBLIC KEY BLOCK-----"
}

data: string - Contains the public key in PGP format, which can be used for encrypting data or verifying signatures associated with the identifier.

Error Handling

  • 400 Bad Request: Returned if the identifier parameter is missing or invalid.

  • 404 Not Found: Returned if no public key is found for the given identifier.

  • 500 Internal Server Error: Returned if there is an issue on the server side processing the request.

Why is it needed?

  • Data Encryption: The retrieved public key can be used to encrypt data that can only be decrypted by the corresponding private key holder.

  • Signature Verification: The public key can be used to verify signatures made by the corresponding private key, ensuring the authenticity and integrity of the data.

Last updated