]>
Commit | Line | Data |
---|---|---|
b54c578e A |
1 | // |
2 | // main.m | |
3 | // tppolicy | |
4 | // | |
5 | // Created by Ben Williamson on 7/13/18. | |
6 | // | |
7 | ||
8 | #import <Foundation/Foundation.h> | |
9 | #import <TrustedPeers/TrustedPeers.h> | |
10 | ||
11 | int main(int argc, const char * argv[]) | |
12 | { | |
13 | NSArray<TPPolicyDocument*> *docs | |
14 | = @[ | |
15 | [TPPolicyDocument policyDocumentWithVersion:1 | |
16 | modelToCategory:@[ | |
17 | @{ @"prefix": @"iPhone", @"category": @"full" }, | |
18 | @{ @"prefix": @"iPad", @"category": @"full" }, | |
19 | @{ @"prefix": @"Mac", @"category": @"full" }, | |
20 | @{ @"prefix": @"iMac", @"category": @"full" }, | |
21 | @{ @"prefix": @"AppleTV", @"category": @"tv" }, | |
22 | @{ @"prefix": @"Watch", @"category": @"watch" }, | |
23 | ] | |
24 | categoriesByView:@{ | |
25 | @"WiFi": @[ @"full", @"tv", @"watch" ], | |
26 | @"SafariCreditCards": @[ @"full" ], | |
27 | @"PCSEscrow": @[ @"full" ] | |
28 | } | |
29 | introducersByCategory:@{ | |
30 | @"full": @[ @"full" ], | |
31 | @"tv": @[ @"full", @"tv" ], | |
32 | @"watch": @[ @"full", @"watch" ] | |
33 | } | |
34 | redactions:@{} | |
35 | keyViewMapping:@[] | |
36 | hashAlgo:kTPHashAlgoSHA256], | |
37 | [TPPolicyDocument policyDocumentWithVersion:2 | |
38 | modelToCategory:@[ | |
39 | @{ @"prefix": @"iCycle", @"category": @"full" }, // new | |
40 | @{ @"prefix": @"iPhone", @"category": @"full" }, | |
41 | @{ @"prefix": @"iPad", @"category": @"full" }, | |
42 | @{ @"prefix": @"Mac", @"category": @"full" }, | |
43 | @{ @"prefix": @"iMac", @"category": @"full" }, | |
44 | @{ @"prefix": @"AppleTV", @"category": @"tv" }, | |
45 | @{ @"prefix": @"Watch", @"category": @"watch" }, | |
46 | ] | |
47 | categoriesByView:@{ | |
48 | @"WiFi": @[ @"full", @"tv", @"watch" ], | |
49 | @"SafariCreditCards": @[ @"full" ], | |
50 | @"PCSEscrow": @[ @"full" ] | |
51 | } | |
52 | introducersByCategory:@{ | |
53 | @"full": @[ @"full" ], | |
54 | @"tv": @[ @"full", @"tv" ], | |
55 | @"watch": @[ @"full", @"watch" ] | |
56 | } | |
57 | redactions:@{} | |
58 | keyViewMapping:@[] | |
59 | hashAlgo:kTPHashAlgoSHA256], | |
60 | [TPPolicyDocument policyDocumentWithVersion:3 | |
61 | modelToCategory:@[ | |
62 | @{ @"prefix": @"Watch7", @"category": @"full" }, // upgraded | |
63 | @{ @"prefix": @"iCycle", @"category": @"full" }, | |
64 | @{ @"prefix": @"iPhone", @"category": @"full" }, | |
65 | @{ @"prefix": @"iPad", @"category": @"full" }, | |
66 | @{ @"prefix": @"Mac", @"category": @"full" }, | |
67 | @{ @"prefix": @"iMac", @"category": @"full" }, | |
68 | @{ @"prefix": @"AppleTV", @"category": @"tv" }, | |
69 | @{ @"prefix": @"Watch", @"category": @"watch" }, | |
70 | ] | |
71 | categoriesByView:@{ | |
72 | @"WiFi": @[ @"full", @"tv", @"watch" ], | |
73 | @"SafariCreditCards": @[ @"full" ], | |
74 | @"PCSEscrow": @[ @"full" ] | |
75 | } | |
76 | introducersByCategory:@{ | |
77 | @"full": @[ @"full" ], | |
78 | @"tv": @[ @"full", @"tv" ], | |
79 | @"watch": @[ @"full", @"watch" ] | |
80 | } | |
81 | redactions:@{} | |
82 | keyViewMapping:@[] | |
83 | hashAlgo:kTPHashAlgoSHA256], | |
84 | ]; | |
85 | ||
86 | for (TPPolicyDocument *doc in docs) { | |
87 | NSString *base64 = [doc.protobuf base64EncodedStringWithOptions:0]; | |
88 | printf("policyVersion: %llu,\n", doc.policyVersion); | |
89 | printf("policyHash: \"%s\",\n", doc.policyHash.UTF8String); | |
90 | printf("policyData: \"%s\"\n", base64.UTF8String); | |
91 | } | |
92 | return 0; | |
93 | } |