mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
28 lines
692 B
JavaScript
28 lines
692 B
JavaScript
type SignatureMethod = 'HMAC-SHA1' | 'PLAINTEXT';
|
|
type Token = {key: string, secret?: string};
|
|
type RequestData = {
|
|
url: string,
|
|
method: string,
|
|
data?: {[string]: string}
|
|
};
|
|
|
|
type OAuth1Config = {
|
|
consumer: {
|
|
key: string,
|
|
secret: string
|
|
},
|
|
signature_method: 'HMAC-SHA1' | 'RSA-SHA1' | 'PLAINTEXT';
|
|
version: '1.0',
|
|
hash_function: (signatureMethod: SignatureMethod, key: string) => string
|
|
};
|
|
|
|
declare class OAuth1 {
|
|
constructor (config: OAuth1Config): OAuth1;
|
|
authorize: (data: RequestData, token: Token | null) => RequestData;
|
|
toHeader: (data: RequestData) => {'Authorization': string};
|
|
}
|
|
|
|
declare module 'oauth-1.0a' {
|
|
declare module .exports: typeof OAuth1
|
|
}
|