Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async attemptAutomaticProofUpload(
claim: KeybaseClaim,
signature: string,
username: string,
address: string
) {
const signedClaim = { claim, signature }
try {
cli.action.start(`Attempting to automate keybase proof`)
const publicFolderPrefix = `/keybase/public/${username}/`
await this.ensureKeybaseFilePathToProof(publicFolderPrefix)
const fileName = proofFileName(address)
const tmpPath = `${tmpdir()}/${fileName}`
writeFileSync(tmpPath, JSON.stringify(signedClaim))
await execCmdWithError(
'keybase',
['fs', 'cp', tmpPath, publicFolderPrefix + keybaseFilePathToProof + '/' + fileName],
{ silent: true }
)
cli.action.stop()
cli.action.start(`Claim successfully copied to the keybase file system, verifying proof`)
// Wait for changes to propagate
await sleep(3000)
const verificationError = await verifyKeybaseClaim(claim, address)
if (verificationError) {
throw new Error(`Claim is not verifiable: ${verificationError}`)
}
printManualInstruction(
claim: KeybaseClaim,
signature: string,
username: string,
address: string
) {
const fileName = proofFileName(address)
writeFileSync(fileName, JSON.stringify({ claim, signature }))
console.info(
`\nProving a keybase claim requires you to publish the signed claim on your Keybase file system to prove ownership. We saved it for you under ${fileName}. It should be hosted in your public folder at ${keybaseFilePathToProof}/${fileName}, so that it is available under ${targetURL(
username,
address
)}\n`
)
}