Example #1
0
 public DownloadParameter Build()
 {
     return(new DownloadParameter(
                TransactionHash,
                AccountPrivateKey,
                PrivacyStrategy ?? PlainPrivacyStrategy.Create(),
                ValidateDigest ?? false));
 }
 public UploadParameter Build()
 {
     return(new UploadParameter(Data, SignerPrivateKey, RecipientPublicKey, RecipientAddress,
                                ComputeDigest ?? false,
                                DetectContentType ?? false,
                                TransactionDeadline ?? 12,
                                TransactionMosaics,
                                UseBlockchainSecureMessage ?? false,
                                PrivacyStrategy ?? PlainPrivacyStrategy.Create()));
 }
Example #3
0
 public DirectDownloadParameter Build()
 {
     return new DirectDownloadParameter(
         TransactionHash,
         AccountPrivateKey,
         DataHash,
         ValidateDigest,
         PrivacyStrategy ?? PlainPrivacyStrategy.Create(),
         Digest);
 }
Example #4
0
        public IObservable <Stream> GetByteStream(string dataHash, IPrivacyStrategy privacyStrategy, string digest)
        {
            CheckParameter(dataHash != null, "dataHash is required");

            var privacyStrategyToUse = privacyStrategy ?? PlainPrivacyStrategy.Create();

            ValidateDigest(digest, dataHash);

            return(FileRepository.GetByteStream(dataHash).Select(stream => privacyStrategyToUse.DecryptStream(stream)));
        }
Example #5
0
        public IObservable <FileUploadResponse> UploadByteStream(Func <Stream> byteStreamFunction,
                                                                 IPrivacyStrategy privacyStrategy, bool?computeDigest)
        {
            CheckParameter(byteStreamFunction != null, "byteStreamFunction is required");

            var computeDigestToUse   = computeDigest ?? false;
            var privacyStrategyToUse = privacyStrategy ?? PlainPrivacyStrategy.Create();

            var digest     = ComputeDigest(byteStreamFunction, privacyStrategyToUse, computeDigestToUse);
            var dataHashOb =
                FileRepository.AddByteStream(privacyStrategyToUse.EncryptStream(byteStreamFunction?.Invoke()));

            return(dataHashOb.Select(dataHash => new FileUploadResponse(dataHash, CurrentTimeMillis(), digest)));
        }
 public UploadParameterBuilder WithPlainPrivacy()
 {
     PrivacyStrategy = PlainPrivacyStrategy.Create();
     return(this);
 }
Example #7
0
 public DirectDownloadParameterBuilder WithPlainPrivacy()
 {
     PrivacyStrategy = PlainPrivacyStrategy.Create();
     return this;
 }