flickr-sdk
Version:
Almost certainly the best Flickr API client in the world for node and the browser
54 lines (53 loc) • 1.71 kB
TypeScript
/**
* @see https://www.flickr.com/services/api/auth.oauth.html
*/
export declare class OAuth {
private consumerKey;
private consumerSecret;
constructor(consumerKey: string, consumerSecret: string);
/**
* Returns the number of seconds since January 1, 1970 00:00:00 GMT.
* @see https://oauth.net/core/1.0a/#nonce
*/
timestamp(): string;
/**
* Generates a random string. OAuth 1.0 defines a
* nonce as a value unique within a given timestamp in seconds.
* @see https://oauth.net/core/1.0a/#nonce
*/
nonce(): string;
/**
* The signature method is always HMAC-SHA1.
* @see https://oauth.net/core/1.0a/#rfc.section.9.2
*/
readonly signatureMethod = "HMAC-SHA1";
/**
* The version is always 1.0.
*/
readonly version = "1.0";
/**
* Creates an object with the standard OAuth 1.0 query params
* for this instance.
*/
params(): {
oauth_nonce: string;
oauth_timestamp: string;
oauth_consumer_key: string;
oauth_signature_method: string;
oauth_version: string;
};
/**
* Calculates the OAuth 1.0 signing key for this consumer secret,
* optionally supplying `tokenSecret`.
*/
signingKey(tokenSecret?: string): string;
/**
* Calculates the OAuth 1.0 base string for `method`, `url` and `params`.
*/
baseString(method: string, url: string, params: Record<string, any>): string;
/**
* Calculates the OAuth 1.0 signature for `method` and `url`,
* optionally including `tokenSecret`.
*/
signature(method: string, url: string, params: Record<string, any>, tokenSecret?: string): string;
}