Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Commit 7122ea0

Browse files
Adding remoteRegistrationId interface on SessionCipher objects.
1 parent fc2b2f9 commit 7122ea0

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

AxolotlKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "AxolotlKit"
3-
s.version = "0.6"
3+
s.version = "0.6.1"
44
s.summary = "AxolotlKit is a Free implementation of the Axolotl protocol in Objective-C"
55
s.homepage = "https://github.com/WhisperSystems/AxolotlKit"
66
s.license = "GPLv2"

AxolotlKit/Classes/SessionCipher.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@
2727

2828
- (NSData*)decrypt:(id<CipherMessage>)whisperMessage;
2929

30+
- (int)remoteRegistrationId;
31+
- (int)sessionVersion;
32+
3033
@end

AxolotlKit/Classes/SessionCipher.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,24 @@ + (NSData*)currentProtocolVersion{
267267
}
268268

269269

270+
- (int)remoteRegistrationId{
271+
SessionRecord *record = [self.sessionStore loadSession:self.recipientId deviceId:_deviceId];
272+
273+
if (!record) {
274+
@throw [NSException exceptionWithName:NoSessionException reason:@"Trying to get registration Id of a non-existing session." userInfo:nil];
275+
}
276+
277+
return record.sessionState.remoteRegistrationId;
278+
}
279+
280+
- (int)sessionVersion{
281+
SessionRecord *record = [self.sessionStore loadSession:self.recipientId deviceId:_deviceId];
282+
283+
if (!record) {
284+
@throw [NSException exceptionWithName:NoSessionException reason:@"Trying to get the version of a non-existing session." userInfo:nil];
285+
}
286+
287+
return record.sessionState.version;
288+
}
289+
270290
@end

0 commit comments

Comments
 (0)