API Reference

Use the verifyPassword method to verify the password for accessing a specific file identified by a content identifier (CID).

try {
  const fileId = "file_id_here"; // The ID of the file for which you want to verify access.
  const cid = "content_identifier_here"; // The CID for accessing the file.
  const password = 'access_password'; // The password to verify.

  const [, error] = await sdk.fileAccess.verifyPassword({
    fileId,
    cid,
    body: { password },
  });

  // Check if the password is valid
  if (error) {
    console.log("Invalid password. Access denied.");
  } else {
    console.log("Password verified. Access granted.");
  }
} catch (error) {
  console.error("An unexpected error occurred while verifying the password:", error.message);
}

Params

  • fileId (string): The ID of the file for which you want to verify access.
  • cid (string): The content identifier (CID) for accessing the file.
  • body (object): An object containing the access password to verify.

Required API Key Permission

  • Upload File