@expressive-analytics/deep-thought-service
Version:
Typescript conversion of Deep Thought Services (formerly providers)
33 lines (32 loc) • 1.2 kB
TypeScript
import { DT, DTModel } from '@expressive-analytics/deep-thought-js';
export interface DTRequestorI extends DT {
name: string;
url: string;
status: number;
consumer_key: string;
}
export declare class DTRequestor extends DTModel {
protected static $T: string;
$public: DTRequestorI;
protected secret: any;
protected settings: Record<string, any>;
consumer_key: string;
static create(params: any): DTRequestor;
/**
ensures that consumer requests come from a known session
@return returns a token to be included in requests to consumers
*/
/** generate a valid consumer token
@param consumer_key - should come from api config
@param consumer_secret - should come from api config
@param permutation - varies the token, default varies by session id. Use this to generate state-free tokens
*/
consumerToken(): string;
verifyConsumerToken(consumer_token: any): boolean;
/**
ensures that provider requests come from a known source (this token should never be public!)
@return returns a token to be included in reqests to providers
*/
providerToken(): string;
verifyProviderToken(token: any): boolean;
}