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 content identifier (CID) for accessing the file.
  const accessInfo = {
    password: 'access_password' // The password to verify.
  }

  const verificationResult = await sdk.fileAccess.verifyPassword(
    fileId,
    cid,
    accessInfo
  )
  if (verificationResult.accessGranted) {
    console.log('Access granted.')
  } else {
    console.log('Access denied.')
  }
} catch (error) {
  console.error(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.
  • accessInfo (object): An object containing the access password to verify.

Required API Key Permission

  • Upload File