Skip to content

Instantly share code, notes, and snippets.

@Philonous
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save Philonous/164038fe1c9a4a98ee22 to your computer and use it in GitHub Desktop.

Select an option

Save Philonous/164038fe1c9a4a98ee22 to your computer and use it in GitHub Desktop.

Type definitions

TYPE JID = Simple

  • String

TYPE Boolean = Simple

UInt8
1 represents true, 0 represents false

TYPE MaybeError = Struct

UInt 8
0 success, 1 on error
String
Error Message on error or empty string otherwise

TYPE EntityDescription = Struct

JID
JID of the entity
String
Display name of the entity
Bool
Whether we have an authorized public key on file

Methods

METHOD import_key

import a public key

In

String
location of the key like filename / url

Out

METHOD mark_key_verified

Mark a public key as verified for a certain identity

In

String
ID of the key to mark as verified
String
identity to mark the key as verified for

Out

Possible error conditions

  • “key not found”

METHOD revoke_key

Mark a key as revoked

in

String
ID of the key to be marked ‘revoked’
String
Revocation reson (if any)

out

Possible error conditions:

  • “key not found”

METHOD initiate_challenge

Initiate a ZKP challenge with a peer.

In

JID
Peer to challenge
String
Message (hint / question) to send to the other peer
String
Shared secret to verify against

Out

String
The Challenge ID generated for this Challenge Used to track the result of the challenge

Possible error conditions

  • “unknown peer”

METHOD respond_challenge

Respond to a ZKP challenge

In

String
Challenge ID to respond to
String
The shared secret

Out

Boolean
Whether the challenge succeeded or not We should be able to determine whether the ZKP-challenge succeeded immediately since we already have all the necessary data

Possible Error conditions:

  • “challenge key not found”

METHOD get_available_entities

Get list of available entities

In

Out

  • List OF EntityDescription

METHOD get_unavailable_entities

Get list of unavailable (but known) entities

In

Out

  • List of Entity

METHOD get_trust_status

Get the trust status of an entity

In

  • JID Entity to check the trust status of

Out

Boolean
Whether this entity is trusted

Possible Error conditions:

  • “no such entity” : Entity is unknown to us

METHOD get_entity_pubkey

Get the ID of the entities active public key

In

JID
Entity to get the pubkey from

Out

String
ID of the entities active public key (or empty)

Possible Error conditions:

  • “no such entity” : Entity is unknown to us

METHOD add_peer

Add a new peer

In

JID
JID of the peer to add
String
Name of the peer to add

Out

METHOD remove_peer

Remove a known peer and cancel all subscriptions

In

JID
Jid of the peer to remove

Out

Possible Error conditions:

  • “no such entity” : Entity is unknown to us

METHOD register_account

register a new XMPP account

In

String
The server to register the account at
String
username
String
password

Out

METHOD login

Login with the configured settings

In

Out

METHOD logout

Logout

In

Out

Signals

SIGNAL received_challenge

Out

JID
Whom we received the challenge from
String
The (unique) challenge ID (used to respond to this challenge with respond_challenge)
String
Message (hint / question) from the other peer

SIGNAL challenge_result

The result of a challenge initiated by us

Out

JID
The entity we sent the challenge to
String
The (unique) challenge ID
Boolean
Whether the challenge succeeded (True) or failed (False)

SIGNAL challenge_timeout

A challenge initiated by us timed out

Out

JID
The entity we sent the challenge to
String
The (unique) challenge ID

SIGNAL connection_state_changed

Out

String
Enumeration of Connection states. Allowable values
  • “offline”
  • “connecting”
  • “connected”

SIGNAL peer_status_change

Out

JID
JID of the peer who’s status changed
String
New status
“available”
Peer is now available
“unavailable”
Peer is now unavailable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment