fruit-company
Version:
Apple services library
39 lines (38 loc) • 1.45 kB
TypeScript
import { SereneAuthority, SereneAuthorityAuthenticateOptions, SereneAuthorityRefreshOptions } from "serene-front";
/**
* A token used to interact with Apple Music.
*/
export declare class MusicDeveloperToken implements SereneAuthority {
private readonly appId;
private readonly teamId;
private readonly keyId;
private readonly privateKey;
/**
* Create a token to interact with Apple Music.
*
* @param appId An app identifier from an Apple developer account.
* @param teamId A team identifier from an Apple developer account.
* @param keyId The identifier of the key used to sign requests.
* @param privateKey An Apple Music key generated using an Apple developer account.
*/
constructor(appId: string, teamId: string, keyId: string, privateKey: string);
/**
* The bearer token used to decorate requests.
*/
private _bearerToken;
get retryLimit(): number;
get isValid(): boolean;
/**
* Access the bearer token returning `undefined` if the token is not valid.
*
* Use this to share the same token between a backend using this
* library and a front end using the MusicKit JS library.
*/
get bearerToken(): string | undefined;
refresh({}: SereneAuthorityRefreshOptions): Promise<void>;
authenticate({ fetchRequest }: SereneAuthorityAuthenticateOptions): Promise<Request>;
/**
* @ignore
*/
toString(): string;
}