-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
41 lines (36 loc) · 1.04 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
declare type KeySecretPair = {
key: string
secret: string
}
declare type ConfigOptions = {
cors?: string[]
cache?: object
realms?: KeySecretPair[]
apps: KeySecretPair[]
}
declare type ConfigData = {
appId: string
timestamp: number
nonceStr: string
signature: string
[property: string]: any
}
export function Config(options: ConfigOptions): Config
export class Config {
constructor(options: ConfigOptions)
static load(file: string): Config
apps: KeySecretPair[]
realms: KeySecretPair[]
getApp(key: string): KeySecretPair
getRealm(key: string): KeySecretPair
isAllowedOrigin(origin: string): boolean
}
export function Sdk(config: Config): Sdk
export class Sdk {
constructor(config: Config)
getAccessToken(appKey: string, appSecret: string): Promise<string>
getTicket(appKey: string, appSecret: string): Promise<string>
createConfig(appKey: string, appSecret: string, params?: object): Promise<ConfigData>
verifyRealmSign(realmKey: string, payload: string, sign: string): boolean
}
export function mock(): () => void