2016-11-17 15:50:23 +01:00
|
|
|
/*
|
|
|
|
Copyright 2016 Chris Ballinger
|
|
|
|
Copyright 2016 OpenMarket Ltd
|
|
|
|
Copyright 2016 Vector Creations Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
2016-04-09 02:24:41 +02:00
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import "OLMSerializable.h"
|
|
|
|
|
2016-04-14 01:53:47 +02:00
|
|
|
@class OLMSession;
|
|
|
|
|
|
|
|
@interface OLMAccount : NSObject <OLMSerializable, NSSecureCoding>
|
2016-04-09 02:24:41 +02:00
|
|
|
|
|
|
|
/** Creates new account */
|
|
|
|
- (instancetype) initNewAccount;
|
|
|
|
|
|
|
|
/** public identity keys. base64 encoded in "curve25519" and "ed25519" keys */
|
|
|
|
- (NSDictionary*) identityKeys;
|
|
|
|
|
|
|
|
/** signs message with ed25519 key for account */
|
2016-04-14 01:53:47 +02:00
|
|
|
- (NSString*) signMessage:(NSData*)messageData;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
|
|
|
/** Public parts of the unpublished one time keys for the account */
|
|
|
|
- (NSDictionary*) oneTimeKeys;
|
|
|
|
|
2021-12-14 16:40:22 +01:00
|
|
|
/**
|
|
|
|
* Deprecated use unPublishedFallbackKey
|
|
|
|
*/
|
2021-08-18 15:44:34 +02:00
|
|
|
- (NSDictionary*) fallbackKey;
|
|
|
|
|
2021-12-14 16:40:22 +01:00
|
|
|
/**
|
|
|
|
Public part of the unpublished fallback key for the account, if present and unublished.
|
|
|
|
*/
|
|
|
|
- (NSDictionary*) unpublishedFallbackKey;
|
|
|
|
|
2016-04-14 01:53:47 +02:00
|
|
|
- (BOOL) removeOneTimeKeysForSession:(OLMSession*)session;
|
|
|
|
|
2016-04-09 02:24:41 +02:00
|
|
|
/** Marks the current set of one time keys as being published. */
|
2016-10-13 16:10:00 +02:00
|
|
|
- (void) markOneTimeKeysAsPublished;
|
2016-04-09 02:24:41 +02:00
|
|
|
|
2021-12-14 16:40:22 +01:00
|
|
|
/** Forget about the old fallback key.
|
|
|
|
* This should be called once you are reasonably certain that you will not
|
|
|
|
* receive any more messages that use the old fallback key
|
|
|
|
*/
|
|
|
|
- (void) forgetFallbackKey;
|
|
|
|
|
2016-04-09 02:24:41 +02:00
|
|
|
/** The largest number of one time keys this account can store. */
|
|
|
|
- (NSUInteger) maxOneTimeKeys;
|
|
|
|
|
|
|
|
/** Generates a number of new one time keys. If the total number of keys stored
|
|
|
|
* by this account exceeds -maxOneTimeKeys then the old keys are
|
|
|
|
* discarded. */
|
|
|
|
- (void) generateOneTimeKeys:(NSUInteger)numberOfKeys;
|
|
|
|
|
2021-08-18 15:44:34 +02:00
|
|
|
/** Generates a fallback key. */
|
|
|
|
- (void) generateFallbackKey;
|
|
|
|
|
2016-04-09 02:24:41 +02:00
|
|
|
@end
|