DashKite CLI
This project is experimental and should not be used for production yet.
Your DashKite Profile
Locally, DashKite uses the file .dashkite
to manage your profile. CLI commands that access private resources require your profile. Your .dashkite
profile is a YAML file structured like this:
.dashkite
profile:
publicKey: 6ovGwDUSNRgV2RvTONsw6JBU2kCZA379ELrsS3/ojQo=
device:
privateKey: Q8kehMPhEWxyoP3MlbX9LAIMCeO9YRSekzTdFWRQqsY=
publicKey: a5xasUsJTcQ5w0UwERNb98TOUHw5e+grUVym+jq1aD4=
Your profile public-key serves to anonymously identify and reference your profile. Private data is encrypted using the corresponding private-key, but it is not stored directly.
To safely make your profile private-key available to multiple devices, each device is assigned a device key-pair. The device public-key is used to identify the device and authorize requests to the DashKite API, while the device private-key is used to encrypt the profile private key before storing it with the API.
Using this scheme, the device private-key never leaves your device, and the profile private-key is only ever stored in an encrypted form. Therefore, if you delete .dashkite
, you lose access to your profile private key and your authorization to access private resources.
Installation
npm install dashkite -g
This gives you the command-line executable kite
Examples
Creating a Profile
$ kite profile add david
[dash] warn: no credentials found in /Users/david/desktop-test or its direct ancestors.
[dash] warn: creating profile...
[dash] info: saving credentials in /Users/david/desktop-test/.dashkite
[dash] info: saving new profile with DashKite API...
[dash] info: new profile ready
[dash] info: updating profile with nickname...
[dash] info: profile nickname updated to david
Adding a New Device to Your Profile
###
## Start from a new device we'd like to name "phone"
###
$ kite profile link david
[dash] info: fetching test public key
[dash] info: saving profile public key in local profile
$ kite device add phone
[dash] info: using profile from [/Users/david/phone-test]
[dash] warn: no device key has been yet assigned for this device
[dash] info: updating profile with provisional device...
[dash] info: provisional device saved with profile
[dash] info: saving device key-pair to local .dashkite profile...
[dash] info: device key pair added
[dash] info: use an already authorized device to complete this device's authorization
###
## On first "device"
###
$ kite device authorize phone
[dash] info: using profile from [/Users/david/desktop-test]
[dash] info: fetching provisional device info...
[dash] info: encrypting profile private key for new device
[dash] info: authorizing device "phone"...
[dash] info: success
[dash] info: use the below PIN to complete the authorization on the new device
[dash] info: PIN: R1B1xA
###
## Back to the second "device"
###
$ kite device pin R1B1xA
[dash] info: using profile from [/Users/david/phone-test]
[dash] info: decrypting profile private key from old device
[dash] info: encrypting profile private key for phone
[dash] info: completing device authorization...
[dash] info: success
[dash] info: this device is now fully authorized and ready to use
Posting to DashKite
###
## This assumes you already have a profile setup
###
$ kite post add 'Hello World!'
[dash] info: using profile from [/Users/david/desktop-test]
[dash] info: posting update...
[dash] info: success
###
## You can also post from files using stdin, including newline characters
###
$ echo "Hello, from stdin" > foo.txt
$ echo "We can write multiple lines here, too." >> foo.txt
$ kite post add < foo.txt
[dash] info: using profile from [/Users/david/desktop-test]
[dash] info: posting update...
[dash] info: success
###
## We can read these posts, newest first
###
$ kite post list david
[dash] info: looking for posts from "david"...
-----------------------------------------
@david April 18th 2018, 02:35:41 pm
-----------------------------------------
Hello, from stdin
We can write multiple lines here, too.
-----------------------------------------
@david April 18th 2018, 02:34:08 pm
-----------------------------------------
Hello World!
###
## To view anyone else's posts, just put their profile name in this command.
###
Your Feed
###
## This assumes you already have a profile setup.
###
###
## At first, your feed is empty.
###
$ kite feed
[dash] info: using profile from [/Users/david/desktop-test]
[dash] info: fetching your latest...
[dash] warn: Oh, there's nothing to see here
###
## So, follow anyone by naming them.
###
$ kite profile follow bob
[dash] info: using profile from [/Users/david/desktop-test]
[dash] info: fetching "bob" public key...
[dash] info: following "bob"...
[dash] info: success
###
## Anyone you follow shows up in your feed
###
$ kite feed
[dash] info: using profile from [/Users/david/desktop-test]
[dash] info: fetching your latest...
-----------------------------------------
@bob April 18th 2018, 06:55:02 pm
-----------------------------------------
Of course. We're doing the whole game-day spread.
-----------------------------------------
@david April 18th 2018, 03:48:41 pm
-----------------------------------------
Are you going to watch the game tomorrow, @bob?
-----------------------------------------
@david April 18th 2018, 02:35:41 pm
-----------------------------------------
Hello, from stdin
We can write multiple lines here, too.
-----------------------------------------
@david April 18th 2018, 02:34:08 pm
-----------------------------------------
Hello World!
-----------------------------------------
@bob April 16th 2018, 01:45:21 pm
-----------------------------------------
My name is Bob, and I like sports.
###
## Your feed is arranged in reverse-chronological order, and includes you, so you'll see everything ordered.
###
Command-Line Usage
Feed
kite feed
This command serves up the freshest posts from the people you follow.
Profile
add
kite profile add [profile-name]
This command allows you to create a new DashKite profile or update the name of an existing profile. Your profile is stored within a file named .dashkite
. If it cannot be found in your working directory or its ancestors, one is automatically generated and saved in your current working directory. See Your DashKite Profile for more information.
If you already have a profile, add
will update your profile's name. Names must be unique, so this command will fail if you choose a name that conflicts with a name someone else picked.
link
kite profile link [profile-name]
This command allows you to link a new device with an existing profile. You cannot use this command if you already have a .dashkite
file. link
takes the profile name you provide, looks up the public key for that profile, and creates a .dashkite
stub. You then need to go through the new device flow to authorize this device.
follow
kite profile follow [profile-name]
This command allows you to follow the posts of an existing profile in your feed. After you follow them, their posts will appear in your feed the next time you check it.
unfollow
kite profile unfollow [profile-name]
This command allows you to stop following the posts of an existing profile in your feed. After you unfollow them, their posts will disappear from your feed the next time you check it.
source
kite source [profile-name]
This command takes a given profile name and provides a list of profiles they follow, ordered by when they started following -- newest first.
followers
kite followers [profile-name]
This command takes a given profile name and provides a list of profiles that follow them, ordered by when those profiles started following the target -- newest first.
block
kite block [profile-name]
This command allows you to manage who follows you on DashKite. Issuing this command dissolves the follow relationships between your account and theirs and prevents them from following you. That keeps you out of their feed, but because your posts are public, your posts will still be visible via the kite list
command.
unblock
kite unblock [profile-name]
This command allows you to remove a block on another profile, but it does not restore follow relationships between your accounts, even if they previously existed. After unblocking someone, their profile will be able to follow yours.
Device
add
kite device add [device-name]
This command allows you to add a new device to your profile. This merely places a request with your profile from a new device, and is part of a larger new device flow.
authorize
kite device authorize [device-name]
This command authorizes a new device, requested via kite device add
. It is part of the new device flow. You use authorize
from an already-authorized device. It uses its access to the profile private key to encrypt a copy for the new device with asymmetric encryption.
This command grants temporary authorization to the new device's public device key, allowing it to access the API, but without access to the profile private key to access private data. It returns a 6-character PIN to be used with the new device to complete the authorization flow. You have 3 minutes to enter this PIN before re-submitting authorization.
pin
kite device pin [device-PIN]
This command completes the new device flow. You get a PIN when using kite device authorize
. Using this PIN allows the API to permanently authorize the new device, retrieve the encrypted profile private key, and replace it with a copy only the new device can decrypt.
After completing the new device flow, the device is ready and has full access to the profile.
delete
kite device delete [device-name]
This command causes the profile to forget the target device. The public key entry is deleted, including the encrypted copy of the profile private key, denying the device access to both the API and any private data.
Post
add
kite post add [text]
kite post add < [file]
This command creates a DashKite post attributed to your profile. You may either input the content directly on the commandline, or pipe in a file. New-line characters are maintained.
list
kite post list [profile name]
This command lists out the posts from the target profile in reverse chronological order. Because DashKite posts are public, you may use this command without a .dashkite
profile and see the posts from any profile you specify.
delete
kite post delete [post ID]
This is a WIP command to delete a target post. It is functional, but there is currently no way to view a post's ID in the CLI tool.