How to use the @celo/contractkit/lib/identity/claims/keybase.proofFileName function in @celo/contractkit

To help you get started, we’ve selected a few @celo/contractkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celo-org / celo-monorepo / packages / cli / src / commands / account / claim-keybase.ts View on Github external
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}`)
      }
github celo-org / celo-monorepo / packages / cli / src / commands / account / claim-keybase.ts View on Github external
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`
    )
  }