Keyboard Module


Version Keyboard 1.4.1

Table of Contents

Usage

To use the Keyboard module, you can import it into your project from the Firebolt SDK:

import { Keyboard } from '@firebolt-js/sdk'

Overview

Methods for prompting users to enter text with task-oriented UX

Methods

email

Prompt the user for their email address with a simplified list of choices.

function email(type: EmailUsage, message: string): Promise<string>

Parameters:

Param Type Required Description
type EmailUsage true Why the email is being requested, e.g. sign on or sign up
values: 'signIn' \| 'signUp'
message string false The message to display while prompting

Promise resolution:

Capabilities:

Role Capability
uses xrn:firebolt:capability:input:keyboard

Examples

Prompt the user to select or type an email address

JavaScript:

import { Keyboard } from '@firebolt-js/sdk'

let email = await Keyboard.email(
  'signIn',
  'Enter your email to sign into this app',
)
console.log(email)

Value of email:

'user@domain.com'
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Keyboard.email",
  "params": {
    "type": "signIn",
    "message": "Enter your email to sign into this app"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "user@domain.com"
}

Prompt the user to type an email address to sign up

JavaScript:

import { Keyboard } from '@firebolt-js/sdk'

let email = await Keyboard.email(
  'signUp',
  'Enter your email to sign up for this app',
)
console.log(email)

Value of email:

'user@domain.com'
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Keyboard.email",
  "params": {
    "type": "signUp",
    "message": "Enter your email to sign up for this app"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "user@domain.com"
}

password

Show the password entry keyboard, with typing obfuscated from visibility

function password(message: string): Promise<string>

Parameters:

Param Type Required Description
message string false The message to display while prompting

Promise resolution:

Capabilities:

Role Capability
uses xrn:firebolt:capability:input:keyboard

Examples

Prompt the user to enter their password

JavaScript:

import { Keyboard } from '@firebolt-js/sdk'

let value = await Keyboard.password('Enter your password')
console.log(value)

Value of value:

'abc123'
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Keyboard.password",
  "params": {
    "message": "Enter your password"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "abc123"
}

standard

Show the standard platform keyboard, and return the submitted value

function standard(message: string): Promise<string>

Parameters:

Param Type Required Description
message string true The message to display while prompting

Promise resolution:

Capabilities:

Role Capability
uses xrn:firebolt:capability:input:keyboard

Examples

Prompt the user for an arbitrary string

JavaScript:

import { Keyboard } from '@firebolt-js/sdk'

let value = await Keyboard.standard(
  "Enter the name you'd like to associate with this device",
)
console.log(value)

Value of value:

'Living Room'
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Keyboard.standard",
  "params": {
    "message": "Enter the name you'd like to associate with this device"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Living Room"
}

Types

EmailUsage

EmailUsage: {
    SIGN_IN: 'signIn',
    SIGN_UP: 'signUp',
},