Home Reference Source Test

Function

Static Public Summary
public

Control(options: IControlOptions): *

Scene is a decorator you can use to designate a class as a Scene.

public

Input(_options: IInputOptions): *

public

Scene(options: ISceneOptions): *

Scene is a decorator you can use to designate a class as a Scene.

public

asset(path: ...string): string

Returns the fully qualified URL to a static project asset.

public

Since your interactive controls can be run by any client, it's sometimes useful (particularly if you do fancier service integration) to be able to verify that the player is who they say they are. This method provides a means for you to do that. This is what happens:

  1. You create a cryptographically secure challenge for the user. This MUST be done on your service; the challenge is used so that adversaries cannot impersonate users (for instance, by gathering challenge responses for their own integrations then injecting those into your controls).

  2. Mixer servers will create a token based on the challenge and a secret, and return that in the response to this method.

  3. You may transmit the token and challenge to your services and call /api/v1/interactive/identity/verify to get the user ID that corresponds to the token. The API will return a 400 if the challenge is invalid.

Visualized, that's something like this:

public

This signals to Mixer that the controls have been bound and are ready to start taking Interactive calls.

Static Public

public Control(options: IControlOptions): * source

import {Control} from '@mixer/cdk'

Scene is a decorator you can use to designate a class as a Scene. See documentation on IControlOptions for more info.

Params:

NameTypeAttributeDescription
options IControlOptions
  • optional

Return:

*

public Input(_options: IInputOptions): * source

import {Input} from '@mixer/cdk'

Params:

NameTypeAttributeDescription
_options IInputOptions
  • optional

Return:

*

public Scene(options: ISceneOptions): * source

import {Scene} from '@mixer/cdk'

Scene is a decorator you can use to designate a class as a Scene. See documentation on ISceneOptions for more info.

Params:

NameTypeAttributeDescription
options ISceneOptions
  • optional

Return:

*

public asset(path: ...string): string source

import {asset} from '@mixer/cdk'

Returns the fully qualified URL to a static project asset. You can pass multiple path segments to join them together.

Params:

NameTypeAttributeDescription
path ...string

Return:

string

public getIdentityVerification(challenge: string): Promise<string> source

import {getIdentityVerification} from '@mixer/cdk'

Since your interactive controls can be run by any client, it's sometimes useful (particularly if you do fancier service integration) to be able to verify that the player is who they say they are. This method provides a means for you to do that. This is what happens:

  1. You create a cryptographically secure challenge for the user. This MUST be done on your service; the challenge is used so that adversaries cannot impersonate users (for instance, by gathering challenge responses for their own integrations then injecting those into your controls).

  2. Mixer servers will create a token based on the challenge and a secret, and return that in the response to this method.

  3. You may transmit the token and challenge to your services and call /api/v1/interactive/identity/verify to get the user ID that corresponds to the token. The API will return a 400 if the challenge is invalid.

Visualized, that's something like this:


┌──────────┐    challenge  ┌──────────┐                ┌───────┐
│          ├───────────────▶          │                │       │
│          │               │          │─ ─ ─ ─ ─ ─ ─ ─ ▶       │
│   Your   │               │          │                │       │
│ Service  │               │ Controls │                │       │
│          │               │          │                │       │
│          │      token    │          │                │       │
│          │◀──────────────│          ◀ ─ ─ ─ ─ ─ ─ ─ ─│ Mixer │
└─────┬────┘               └──────────┘                │       │
      │                                                │       │
      │                                                │       │
      │    POST /interactive/identity/verify           │       │
      └────────────────────────────────────────────────▶       │
            { "challenge":"...","token:"..." }         │       │
                                                       └───────┘

Params:

NameTypeAttributeDescription
challenge string

Return:

Promise<string>

public isLoaded() source

import {isLoaded} from '@mixer/cdk'

This signals to Mixer that the controls have been bound and are ready to start taking Interactive calls. You need to call this to allow your controls to be displayed.

In the Preact starter, this is called automatically by the MState class.