-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.ts
45 lines (39 loc) · 1.19 KB
/
interfaces.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
42
43
44
45
import * as Redis from 'ioredis';
import * as pRetry from 'p-retry';
export interface IRedisOptions extends Omit<Redis.RedisOptions, 'lazyConnect'> {
uri: string;
tokenKeyPrefix?: string;
}
export type ISpikeRetryOptions = Omit<pRetry.Options, 'unref' | 'onFailedAttempt'>;
export interface ILogger {
trace(message?: any, ...optionalParams: any[]): void;
debug(message?: any, ...optionalParams: any[]): void;
info(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
error(message?: any, ...optionalParams: any[]): void;
}
export interface ISpikeOptions {
spike: {
url: string;
clientId: string;
clientSecret: string;
publicKeyFullPath?: string;
retryOptions?: ISpikeRetryOptions;
};
redis?: IRedisOptions;
token?: {
expirationOffset?: number;
};
logger?: ILogger;
}
export type IValidatedSpikeOptions = ISpikeOptions & { logger: ILogger; token: { expirationOffset: number } };
export interface ISpikeTokenParsed {
aud: string;
sub: string;
scope: string[];
clientId: string;
clientName: string;
iat: number;
exp: number;
iss: string;
}