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 |
Returns the fully qualified URL to a static project asset. |
|
public |
getIdentityVerification(challenge: string): Promise<string> 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:
Visualized, that's something like this: |
|
public |
isLoaded() 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:
Name | Type | Attribute | Description |
options | IControlOptions |
|
Return:
* |
public Input(_options: IInputOptions): * source
import {Input} from '@mixer/cdk'
Params:
Name | Type | Attribute | Description |
_options | IInputOptions |
|
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:
Name | Type | Attribute | Description |
options | ISceneOptions |
|
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:
Name | Type | Attribute | Description |
path | ...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:
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).
Mixer servers will create a token based on the challenge and a secret, and return that in the response to this method.
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:
Name | Type | Attribute | Description |
challenge | 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.