]> git.saurik.com Git - apple/security.git/blob - keychain/Trieste/OctagonTestHarnessXPCService/OctagonTestHarnessXPCService.m
Security-59306.41.2.tar.gz
[apple/security.git] / keychain / Trieste / OctagonTestHarnessXPCService / OctagonTestHarnessXPCService.m
1 // Copyright (c) 2018 Apple Inc. All rights reserved.
2
3 #import "OctagonTestHarnessXPCService.h"
4
5 #import <objc/runtime.h>
6 #import <Security/CKKSControlProtocol.h>
7 #import <Security/SecAccessControlPriv.h>
8 #import "SecDbKeychainItem.h"
9 #import "SecRemoteDevice.h"
10 #import "OTControl.h"
11
12 @interface OctagonTestHarnessXPCService ()
13 @property (strong) SecRemoteDevice *remoteDevice;
14 @end
15
16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Wprotocol"
18
19 @implementation OctagonTestHarnessXPCService
20
21 - (instancetype)init {
22 if ((self = [super init]) != NULL) {
23 self.remoteDevice = [SecRemoteDevice new];
24 if (self.remoteDevice == nil) {
25 return nil;
26 }
27 }
28 return self;
29 }
30
31 - (void)octagonReset:(NSString *)altDSID complete:(void (^)(NSNumber *, NSError *))complete {
32
33 [self.remoteDevice otReset:altDSID complete:^(bool success, NSError * _Nullable error) {
34 complete([NSNumber numberWithBool:success], error);
35 }];
36 }
37
38 - (void)octagonPeerID:(NSString *)altDSID complete:(void (^)(NSString *, NSError *))complete {
39
40 [self.remoteDevice otPeerID:altDSID complete:^(NSString *peerID, NSError * _Nullable error) {
41 complete(peerID, error);
42 }];
43 }
44
45 - (void)octagonInCircle:(NSString *)altDSID complete:(void (^)(NSNumber *, NSError *_Nullable error))complete
46 {
47 [self.remoteDevice otInCircle:altDSID complete:^(bool inCircle, NSError * _Nullable error) {
48 complete(@(inCircle), error);
49 }];
50 }
51
52
53
54
55 @end
56
57 #pragma clang diagnostic pop