Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FIT-Connect-SDK - .NET
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIT-Connect
FIT-Connect-SDK - .NET
Commits
fd9f1b27
Commit
fd9f1b27
authored
2 years ago
by
Klaus Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Added filename to attachment and calculated attachment hash in subscriber
parent
d49f4613
No related branches found
Branches containing commit
No related tags found
1 merge request
!3
Feature/440 mvp net sdk part 1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FitConnect/FluentSubscriber.cs
+7
-2
7 additions, 2 deletions
FitConnect/FluentSubscriber.cs
FitConnect/Models/Attachment.cs
+1
-1
1 addition, 1 deletion
FitConnect/Models/Attachment.cs
with
8 additions
and
3 deletions
FitConnect/FluentSubscriber.cs
+
7
−
2
View file @
fd9f1b27
using
System.Buffers.Text
;
using
System.Buffers.Text
;
using
System.Security.Authentication
;
using
System.Security.Authentication
;
using
System.Security.Cryptography
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Security.Cryptography.X509Certificates
;
using
FitConnect.Models
;
using
FitConnect.Models
;
using
FitConnect.Services
;
using
FitConnect.Services
;
...
@@ -107,8 +108,12 @@ public class FluentSubscriber : Subscriber, IFluentApi<FluentSubscriber> {
...
@@ -107,8 +108,12 @@ public class FluentSubscriber : Subscriber, IFluentApi<FluentSubscriber> {
var
encryptedAttachment
=
SubmissionService
.
GetAttachment
(
Submission
.
Id
,
id
);
var
encryptedAttachment
=
SubmissionService
.
GetAttachment
(
Submission
.
Id
,
id
);
var
content
=
Encryption
.
DecryptData
(
Convert
.
FromBase64String
(
encryptedAttachment
));
var
content
=
Encryption
.
DecryptData
(
Convert
.
FromBase64String
(
encryptedAttachment
));
// TODO Where to get the HASH from?
attachments
.
Add
(
new
Attachment
(
id
,
content
,
"HASH"
));
// TODO where do I get the hash from the server to verify the attachment?
var
hash
=
MD5
.
Create
(
HashAlgorithmName
.
SHA512
.
ToString
())?.
ComputeHash
(
content
)
??
Array
.
Empty
<
byte
>();
attachments
.
Add
(
new
Attachment
(
id
,
content
,
Convert
.
ToBase64String
(
hash
),
"dummy.pdf"
));
}
}
Submission
.
Attachments
=
attachments
;
Submission
.
Attachments
=
attachments
;
...
...
This diff is collapsed.
Click to expand it.
FitConnect/Models/Attachment.cs
+
1
−
1
View file @
fd9f1b27
namespace
FitConnect.Models
;
namespace
FitConnect.Models
;
public
record
Attachment
(
string
Id
,
byte
[]
Content
,
string
Hash
);
public
record
Attachment
(
string
Id
,
byte
[]
Content
,
string
Hash
,
string
Filename
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment