2016-04-09 02:24:41 +02:00
|
|
|
//
|
|
|
|
// OLMSession.h
|
|
|
|
// olm
|
|
|
|
//
|
|
|
|
// Created by Chris Ballinger on 4/8/16.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import "OLMSerializable.h"
|
|
|
|
#import "OLMAccount.h"
|
2016-04-09 23:00:30 +02:00
|
|
|
#import "OLMMessage.h"
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-04-14 01:53:47 +02:00
|
|
|
@interface OLMSession : NSObject <OLMSerializable, NSSecureCoding>
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-11-14 16:54:51 +01:00
|
|
|
- (instancetype) initOutboundSessionWithAccount:(OLMAccount*)account theirIdentityKey:(NSString*)theirIdentityKey theirOneTimeKey:(NSString*)theirOneTimeKey error:(NSError**)error;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-11-14 16:54:51 +01:00
|
|
|
- (instancetype) initInboundSessionWithAccount:(OLMAccount*)account oneTimeKeyMessage:(NSString*)oneTimeKeyMessage error:(NSError**)error;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-11-14 16:54:51 +01:00
|
|
|
- (instancetype) initInboundSessionWithAccount:(OLMAccount*)account theirIdentityKey:(NSString*)theirIdentityKey oneTimeKeyMessage:(NSString*)oneTimeKeyMessage error:(NSError**)error;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-04-09 23:00:30 +02:00
|
|
|
- (NSString*) sessionIdentifier;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-04-09 23:00:30 +02:00
|
|
|
- (BOOL) matchesInboundSession:(NSString*)oneTimeKeyMessage;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2016-04-09 23:00:30 +02:00
|
|
|
- (BOOL) matchesInboundSessionFrom:(NSString*)theirIdentityKey oneTimeKeyMessage:(NSString *)oneTimeKeyMessage;
|
|
|
|
|
|
|
|
/** UTF-8 plaintext -> base64 ciphertext */
|
2016-11-14 16:54:51 +01:00
|
|
|
- (OLMMessage*) encryptMessage:(NSString*)message error:(NSError**)error;
|
2016-04-09 23:00:30 +02:00
|
|
|
|
|
|
|
/** base64 ciphertext -> UTF-8 plaintext */
|
2016-11-14 16:54:51 +01:00
|
|
|
- (NSString*) decryptMessage:(OLMMessage*)message error:(NSError**)error;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
|
|
|
@end
|