mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
git remote add ssk ../SignalServiceKit git remote update git merge -s ours --allow-unrelated-histories --no-commit ssk/master git read-tree --prefix=SignalServiceKit -u ssk/master git commit
37 lines
1 KiB
Objective-C
37 lines
1 KiB
Objective-C
//
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "TSRegisterSignedPrekeyRequest.h"
|
|
#import "TSConstants.h"
|
|
|
|
#import <25519/Curve25519.h>
|
|
#import <AxolotlKit/NSData+keyVersionByte.h>
|
|
#import <AxolotlKit/PreKeyRecord.h>
|
|
#import <AxolotlKit/SignedPreKeyStore.h>
|
|
|
|
@implementation TSRegisterSignedPrekeyRequest
|
|
|
|
- (id)initWithSignedPreKeyRecord:(SignedPreKeyRecord *)signedRecord
|
|
{
|
|
self = [super initWithURL:[NSURL URLWithString:textSecureSignedKeysAPI]];
|
|
self.HTTPMethod = @"PUT";
|
|
|
|
NSDictionary *serializedKeyRegistrationParameters = [self dictionaryFromSignedPreKey:signedRecord];
|
|
|
|
self.parameters = [serializedKeyRegistrationParameters mutableCopy];
|
|
|
|
return self;
|
|
}
|
|
|
|
- (NSDictionary *)dictionaryFromSignedPreKey:(SignedPreKeyRecord *)preKey
|
|
{
|
|
return @{
|
|
@"keyId" : [NSNumber numberWithInt:preKey.Id],
|
|
@"publicKey" : [[preKey.keyPair.publicKey prependKeyType] base64EncodedStringWithOptions:0],
|
|
@"signature" : [preKey.signature base64EncodedStringWithOptions:0]
|
|
};
|
|
}
|
|
|
|
@end
|