private SenderKeyState(uint id, uint iteration, byte[] chainKey, IEcPublicKey signatureKeyPublic, May <IEcPrivateKey> signatureKeyPrivate) { StorageProtos.SenderKeyStateStructure.Types.SenderChainKey senderChainKeyStructure = StorageProtos.SenderKeyStateStructure.Types.SenderChainKey.CreateBuilder() .SetIteration(iteration) .SetSeed(ByteString.CopyFrom(chainKey)) .Build(); StorageProtos.SenderKeyStateStructure.Types.SenderSigningKey.Builder signingKeyStructure = StorageProtos.SenderKeyStateStructure.Types.SenderSigningKey.CreateBuilder() .SetPublic(ByteString.CopyFrom(signatureKeyPublic.Serialize())); if (signatureKeyPrivate.HasValue) { signingKeyStructure.SetPrivate(ByteString.CopyFrom(signatureKeyPrivate.ForceGetValue().Serialize())); } _senderKeyStateStructure = StorageProtos.SenderKeyStateStructure.CreateBuilder() .SetSenderKeyId(id) .SetSenderChainKey(senderChainKeyStructure) .SetSenderSigningKey(signingKeyStructure) .Build(); }
public void SetSenderChainKey(SenderChainKey chainKey) { StorageProtos.SenderKeyStateStructure.Types.SenderChainKey senderChainKeyStructure = StorageProtos.SenderKeyStateStructure.Types.SenderChainKey.CreateBuilder() .SetIteration(chainKey.GetIteration()) .SetSeed(ByteString.CopyFrom(chainKey.GetSeed())) .Build(); _senderKeyStateStructure = _senderKeyStateStructure.ToBuilder() .SetSenderChainKey(senderChainKeyStructure) .Build(); }