Verify Passphrase Component

SkyCrate Ltd. - Graham Robertson


< Bot Exchange Network (B.E.N) Listing | skycrate-verify-passphrase v1.0.0-rc | default

Verify Passphrase is used to aid in the verification of a user's identity by testing their knowledge of a previously stored passphrase. The user is asked to identity three letters contained in the passphrase.

  • Bot Component API Endpoints
  • API Request/Response Schema
  • Custom Chat Responses

  • Supported Languages



    Bot Component Endpoints

    RESTful over HTTPS://

    Simple request/response endpoint. The session_id is to be generated by the client.

    https://skycrate.net/exchange/skycrate-verify-passphrase
    GET This very page you are looking at. Gives you all the juicy details.
    PUT Upload custom responses by sending JSON in the body of the request. The schema for the JSON object is defined below.

    This endpoint returns a generated proxy bot id.

    When using this approach, a proxy component uri will be created using the generated proxy bot id like so:

    https://skycrate.net/exchange/skycrate-verify-passphrase_i6htk12drsk6

    https://skycrate.net/exchange/skycrate-verify-passphrase/<session_id>
    GET A bodge for testing the Verify Passphrase component in the browser.

    POST The endpoint for exchange requests. The POST body is to contain JSON which is defined below.
    PUT Upload custom responses by sending JSON in the body of the request. The schema for the JSON object is defined below.

    Secure Web Socket

    Asynchronous endpoint for easier distribution of messages to multiple clients (perhaps in group conversions).

    wss://skycrate.net/exchange/skycrate-verify-passphrase/<session_id>

    IPC (Internal Use Only)

    Endpoint of the component's parallel process in the server environment.

    ipc://@skycrate-verify-passphrase


    Bot Component Endpoint API

    POST Request / Web Socket Message

    Exchange Body

    Data to be sent with each POST request or Web Socket message.

    Property Type Description
    user_input string Message sent to bot by the user.
    context object Auxillary information used by the bot to determine appropriate responses. Usually only needs to be sent on the first request.

    Session Context

    Auxillary information used by the bot to determine appropriate responses. Usually only needs to be sent on the first request.

    Property Type Description
    passphrase string A secret passphrase used to test a user's identity. Passphrase should be between 6 and 12 characters long but the only real limit is a minimum of 3 characters.
    max_attempts integer Optional. Number of failed password attempts before the bot finishes and reports it has failed.

    Defaults to 3.
    timestamp integer Optional. Provide context for the time of day (use milliseconds from epoch like with Date.now()). Can be used in responses: "Good [time_of_day]!".

    Where [time_of_day] has the values "morning", "afternoon", and "evening" depending on the time provided.

    Defaults to current UTC time.

    Exchange Response

    The bot component response to your exchange request.

    Property Type Description
    action string The name of the action performed.
    response string Text response from bot component to be used in the chat.
    response_time number Time taken, in seconds, to complete the exchange.
    confidence number The confidence that this is the appropriate response. Value lies between 0 and 1.
    out_of_context boolean True if the bot receives input it feels was out of context. The bot has the ability to handle this but you might want to use this opportunity to intercept and do something else in your bot.
    idontknow boolean True if the bot did not understand the user input. The bot has the ability to handle this (eg re-phrasing a question or instruction). However, you might wish to try and understand the input yourself and either switch to another component or append a reply to what this component will say next.
    component_failed boolean True when the component is unable to complete its goal.
    component_done boolean True when the component has successfully fulfilled its goal. This is a good time to check the updated_context.
    updated_context object Any updated or new data from the bot.

    Updated Context

    Any updated or new data from the bot.

    Property Type Description
    max_attempts integer Maximum attempts the user has to verify passphrase.
    attempts_
    remaining
    integer This begins as the same value as max_attempts and the component fails when this reaches 0
    verified boolean True when the passphrase has been verified. You can use component_done and component_failed in lieu of this. Other components this may not be the case so it's good practice to have an explicit "goal-accomplished" boolean. We might have a few sub-goals or outcomes within one bot.

    Custom Responses

    Using a PUT request at either https://skycrate.net/exchange/skycrate-verify-passphrase:<instance_id> or https://skycrate.net/exchange/skycrate-verify-passphrase/<session_id>, you can save your custom responses to the instance or the session and the component will use these responses instead.

    
    const request = require('request');
    request({
      url: "https://skycrate.net/exchange/\
        skycrate-verify-passphrase/rqqmqjjekxty",
      method: 'PUT',
      json: {
        "index": [
          "Hello, World.",
          
          "Good [time_of_day], human."
        ],
        
        "exit": [
          "Goodbye, World.",
          
          "Have a pleasant [time_of_day], human."
        ]
      },
    }, (e, r, b) => {
      if (e) {
        return; // Do some error stuff
      }
      console.log('Responses saved.');
    });
    
    

    Like in the example above, send a dictionary whose keys are the names of the actions you wish to customise. Their corresponding value is an array of possible text responses.

    Bot Actions

    Action Default Responses

    ask_passphrase

    "Type the [index_one], [index_two], and [index_three] characters of your chosen passphrase. Enter this on its own as one word."

    "Enter as a single word the [index_one], [index_two], and [index_three] characters of your stored passphrase. You have [max_attempts] attempts."

    passphrase_denied

    "Passphrase wasn't a match... please try again."

    "Sorry, I didn't quite get that. You have [tries_left] attempts remaining."

    "Just the [index_one], [index_two], and [index_three] letters only please."

    passphrase_verified

    "Thank you! Your passphrase has been verified."

    "Brilliant. That's a match!"

    too_many_attempts

    "Sorry. We cannot verify your passphrase this [time_of_day]."

    "Too many attempts. Try again later."

    exit

    "PASSPHRASE HAS BEEN VERIFIED. GENERATE OR CLEAR SESSION."

    failed

    "PASSPHRASE WAS NOT VERIFIED. GENERATE OR CLEAR SESSION"

    Response Template Values

    Values that you can use when customising the bot's responses.

    Property Type Description
    index_one integer Describes the position of the first requested letter from the passphrase (eg. "1st").
    index_two integer Describes the position of the second requested letter from the passphrase (eg. "3rd").
    index_three integer Describes the position of the third requested letter from the passphrase (eg. "6th").
    time_of_day string Depending on the current time, this value can be "morning", "afternoon", or "evening".


    < Back