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

Commit

Permalink
Adding remoteRegistrationId interface on SessionCipher objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredericJacobs committed Feb 15, 2015
1 parent fc2b2f9 commit 7122ea0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion AxolotlKit.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "AxolotlKit"
s.version = "0.6"
s.version = "0.6.1"
s.summary = "AxolotlKit is a Free implementation of the Axolotl protocol in Objective-C"
s.homepage = "https://github.com/WhisperSystems/AxolotlKit"
s.license = "GPLv2"
Expand Down
3 changes: 3 additions & 0 deletions AxolotlKit/Classes/SessionCipher.h
Expand Up @@ -27,4 +27,7 @@

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

- (int)remoteRegistrationId;
- (int)sessionVersion;

@end
20 changes: 20 additions & 0 deletions AxolotlKit/Classes/SessionCipher.m
Expand Up @@ -267,4 +267,24 @@ + (NSData*)currentProtocolVersion{
}


- (int)remoteRegistrationId{
SessionRecord *record = [self.sessionStore loadSession:self.recipientId deviceId:_deviceId];

if (!record) {
@throw [NSException exceptionWithName:NoSessionException reason:@"Trying to get registration Id of a non-existing session." userInfo:nil];
}

return record.sessionState.remoteRegistrationId;
}

- (int)sessionVersion{
SessionRecord *record = [self.sessionStore loadSession:self.recipientId deviceId:_deviceId];

if (!record) {
@throw [NSException exceptionWithName:NoSessionException reason:@"Trying to get the version of a non-existing session." userInfo:nil];
}

return record.sessionState.version;
}

@end

0 comments on commit 7122ea0

Please sign in to comment.