2 #import <Foundation/Foundation.h>
3 #import <Foundation/NSXPCConnection_Private.h>
4 #import <Security/SecItemPriv.h>
5 #import <Security/Security.h>
8 #include "utilities/SecCFWrappers.h"
9 #include "utilities/SecInternalReleasePriv.h"
10 #import "utilities/debugging.h"
12 #import "keychain/otctl/EscrowRequestCLI.h"
14 @implementation EscrowRequestCLI
16 - (instancetype)initWithEscrowRequest:(SecEscrowRequest*)escrowRequest
18 if((self = [super init])) {
19 _escrowRequest = escrowRequest;
28 [self.escrowRequest triggerEscrowUpdate:@"cli" error:&error];
31 printf("Errored: %s", [[error description] UTF8String]);
35 printf("Complete.\n");
43 NSDictionary* statuses = [self.escrowRequest fetchStatuses:&error];
46 printf("Errored: %s\n", [[error description] UTF8String]);
50 if(statuses.count == 0) {
51 printf("No requests are waiting for a passcode.\n");
55 for(NSString* uuid in statuses.allKeys) {
56 printf("Request %s: %s\n", [uuid UTF8String], [[statuses[uuid] description] UTF8String]);
65 [self.escrowRequest resetAllRequests:&error];
68 printf("Errored: %s\n", [[error description] UTF8String]);
72 printf("Complete.\n");
76 - (long)storePrerecordsInEscrow
79 uint64_t recordsWritten = [self.escrowRequest storePrerecordsInEscrow:&error];
82 printf("Errored: %s\n", [[error description] UTF8String]);
86 printf("Complete: %d records written.\n", (int)recordsWritten);