Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ogre

Hierarchy

  • Ogre

Index

Constructors

Properties

gotUserSubject: BehaviorSubject<undefined | User> = ...
messages: Subject<IBaseMessage> = ...
signaler: Signaler
storageService: StorageService
targetUser: undefined | IUserRef = undefined
user: User

Methods

  • createCircuit(targetUser: undefined | IUserRef, maxORs?: number): string[]
  • Creates the circuit that will determine what users the message will go through. Currently only uses users from the peer list.

    Parameters

    • targetUser: undefined | IUserRef

      target user at the end of the circuit

    • maxORs: number = 1

      max number of users in the circuit

    Returns string[]

    a string of user ids the message will route through

  • layerMessage(circuit: string[], message: string): string
  • Wraps the message in layers. Each layer will be peeled back by a user in the route. Currently does not encrypt anything.

    Parameters

    • circuit: string[]

      generated circuit of user ids

    • message: string

      message to wrap in layers

    Returns string

    A string representing a message wrapped in layers and ready to be sent

  • This observable is used to listen to messages sent to the current user.

    Returns Observable<IBaseMessage>

    An observable that emits messages

  • observePeerList(): Observable<IUserRef[]>
  • An observable used to listen to changes in the peer list. This will emit when someone joins the network, leaves the network or changes their name on the network

    Returns Observable<IUserRef[]>

    An observable that emits the list of peers when it changes.

  • onUserLoaded(): Observable<undefined | User>
  • An observable that can be used to determine when user data has finished loading. Attempting to access some functionality before user data has been loaded will result in some errors.

    Returns Observable<undefined | User>

    An observable that emits when the user data is loaded from storage.

  • peelMessage(layeredMessage: string): undefined | { message: string; next: string }
  • Peels a single layer from the message and returns the contents. If the message is the last one and the current user is the target, then this function will return undefined and emit a new value to the messages subject.

    Parameters

    • layeredMessage: string

      the layered message string to peel a layer from.

    Returns undefined | { message: string; next: string }

    the peeled message or undefined if there was an error or it's the last message.

  • Updates the current target user. The currently target user is the user messages will be sent to.

    Parameters

    Returns void

  • sendMessage(message: string): Promise<void>
  • Sends a message to the currently targeted user via the ogre network. The message will be wrapped in layers and routed through different users. Each user will peel a layer and send it to the next user until it reaches the target.

    Parameters

    • message: string

      message to send

    Returns Promise<void>

  • transferMessage(layeredMessage: string): Promise<void>
  • Transfers a message from the current user to the target in the message.

    Parameters

    • layeredMessage: string

      the layered message to transfer

    Returns Promise<void>

    a promise indicating completion

  • updateAlias(updatedName: string): Promise<User>
  • Updates the user's alias. This will:

    1. Send a message to the signaling server indicating an update to the signature is needed.
    2. Wait till the signaling server responds with the signature.
    3. Update the user's info in memory.
    4. Update the user's info in the storage.

    Parameters

    • updatedName: string

      The new name. The number will stay the same.

    Returns Promise<User>

    A promise with the updated user.

Generated using TypeDoc