1 | export class Signer {
|
2 | |
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | constructor(keyPairId: string, privateKey: string);
|
9 |
|
10 | /**
|
11 | * Create a signed Amazon CloudFront Cookie.
|
12 | */
|
13 | getSignedCookie(options: Signer.SignerOptionsWithPolicy): Signer.CustomPolicy;
|
14 | /**
|
15 | * Create a signed Amazon CloudFront Cookie.
|
16 | */
|
17 | getSignedCookie(options: Signer.SignerOptionsWithoutPolicy): Signer.CannedPolicy;
|
18 | /**
|
19 | * Create a signed Amazon CloudFront Cookie.
|
20 | */
|
21 | getSignedCookie(options: Signer.SignerOptionsWithPolicy, callback: (err: Error, cookie: Signer.CustomPolicy) => void): void;
|
22 | /**
|
23 | * Create a signed Amazon CloudFront Cookie.
|
24 | */
|
25 | getSignedCookie(options: Signer.SignerOptionsWithoutPolicy, callback: (err: Error, cookie: Signer.CannedPolicy) => void): void;
|
26 | /**
|
27 | * Create a signed Amazon CloudFront URL.
|
28 | * Keep in mind that URLs meant for use in media/flash players may have different requirements for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed - mp4:, some require you to add "/cfx/st" into your URL).
|
29 | */
|
30 | getSignedUrl(options: Signer.SignerOptionsWithPolicy | Signer.SignerOptionsWithoutPolicy): string;
|
31 | /**
|
32 | * Create a signed Amazon CloudFront URL.
|
33 | * Keep in mind that URLs meant for use in media/flash players may have different requirements for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed - mp4:, some require you to add "/cfx/st" into your URL).
|
34 | */
|
35 | getSignedUrl(options: Signer.SignerOptionsWithPolicy| Signer.SignerOptionsWithoutPolicy, callback: (err: Error, url: string) => void): void;
|
36 | }
|
37 |
|
38 | declare namespace Signer {
|
39 | export interface SignerOptionsWithPolicy {
|
40 | |
41 |
|
42 |
|
43 | policy: string;
|
44 | }
|
45 | export interface SignerOptionsWithoutPolicy {
|
46 | |
47 |
|
48 |
|
49 | url: string
|
50 | |
51 |
|
52 |
|
53 | expires: number
|
54 | }
|
55 |
|
56 | export interface CustomPolicy {
|
57 | "CloudFront-Policy": string;
|
58 | "CloudFront-Key-Pair-Id": string;
|
59 | "CloudFront-Signature": string;
|
60 | }
|
61 |
|
62 | export interface CannedPolicy {
|
63 | "CloudFront-Expires": number;
|
64 | "CloudFront-Key-Pair-Id": string;
|
65 | "CloudFront-Signature": string;
|
66 | }
|
67 | } |
\ | No newline at end of file |