Hierarchy

  • TypedEmitter
    • Roles

Constructors

Properties

Methods

Constructors

  • Parameters

    • opts: {
          coreManager: CoreManager;
          coreOwnership: CoreOwnership;
          dataType: DataType<DataStore<"auth", "coreOwnership" | "role">, SQLiteTableWithColumns<{}>, "role", {}, {}>;
          deviceKey: Buffer;
          projectKey: Buffer;
      }
      • coreManager: CoreManager
      • coreOwnership: CoreOwnership
      • dataType: DataType<DataStore<"auth", "coreOwnership" | "role">, SQLiteTableWithColumns<{}>, "role", {}, {}>
      • deviceKey: Buffer

        public key of this device

      • projectKey: Buffer

    Returns Roles

Properties

NO_ROLE: Role<"08e4251e36f6e7ed"> = NO_ROLE

Methods

  • Assign a role to the specified deviceId. Devices without an assigned role are unable to sync, except the project creator who can do anything. Only the project creator can assign their own role. Will throw if the device's role cannot assign the role by consulting roleAssignment.

    Parameters

    • deviceId: string
    • roleId:
          | "f7c150f5a3a9a855"
          | "012fd2d431c0bf60"
          | "9e6d29263cba36c9"
          | "8ced989b1904606b"

    Returns Promise<void>

  • Get roles of all devices in the project. For your own device, if you have not yet synced your own role record, the "no role" capabilties is returned. The project creator will have the creator role unless a different one has been assigned.

    Returns Promise<Map<string, Role<
        | "a12a6702b93bd7ff"
        | "f7c150f5a3a9a855"
        | "012fd2d431c0bf60"
        | "9e6d29263cba36c9"
        | "8ced989b1904606b"
        | "08e4251e36f6e7ed">>>

    Map of deviceId to Role

  • Get the role for device deviceId.

    Parameters

    • deviceId: string

    Returns Promise<Role<
        | "a12a6702b93bd7ff"
        | "f7c150f5a3a9a855"
        | "012fd2d431c0bf60"
        | "9e6d29263cba36c9"
        | "8ced989b1904606b"
        | "08e4251e36f6e7ed">>