Skip to content
Snippets Groups Projects
Commit ada4a756 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Changed signatures to match java sdk

parent 2f912f8b
No related branches found
No related tags found
1 merge request!3Feature/440 mvp net sdk part 1
......@@ -47,7 +47,7 @@ public class OAuthServiceTest {
[Test]
public void GetAccessToken_ExpiresInShouldBe1800_WithoutScope() {
var token = _oAuthService.GetTokenAsync(_clientId, _clientSecret).Result;
var token = _oAuthService.AuthenticateAsync(_clientId, _clientSecret).Result;
token.Should().NotBeNull();
token!.ExpiresIn.Should().Be(1800);
token.Scope.Should().Be("send:region:DE");
......@@ -55,7 +55,7 @@ public class OAuthServiceTest {
[Test]
public void GetAccessToken_ScopeShouldMatch_WithScope() {
var token = _oAuthService.GetTokenAsync(_clientId, _clientSecret, "send:region:DE01010")
var token = _oAuthService.AuthenticateAsync(_clientId, _clientSecret, "send:region:DE01010")
.Result;
token.Should().NotBeNull();
token!.ExpiresIn.Should().Be(1800);
......
......@@ -41,8 +41,8 @@ public abstract class FunctionalBaseClass {
/// <param name="clientSecret"></param>
/// <param name="scope"></param>
/// <returns></returns>
public Task<OAuthAccessToken?> GetOAuthTokenAsync(string clientId, string clientSecret, string? scope) {
return ApiService.OAuthService.GetTokenAsync(clientId, clientSecret, scope);
public Task<OAuthAccessToken?> AuthenticateAsync(string clientId, string clientSecret, string? scope) {
return ApiService.OAuthService.AuthenticateAsync(clientId, clientSecret, scope);
}
/// <summary>
......
......@@ -61,7 +61,7 @@ public class Client {
// Anlagen verschlüsseln
var encryptedAttachments = submission.Attachments
.Select(a => _sender.EncryptAttachment(a)).ToList();
.Select(a => _sender.Encrypt("", a)).ToList();
// Anlagen hochladen
await _sender.UploadAttachmentsAsync(encryptedAttachments);
......@@ -70,7 +70,7 @@ public class Client {
var metaData = await _sender.CreateMetadataAsync("", new byte[] { });
// Fachdaten verschlüsseln
var encryptedData = _sender.EncryptDataAsync(submission.Data);
var encryptedData = _sender.Encrypt("", submission.Data);
// Fachdaten & Metadaten hochladen und Einreichung absenden
await _sender.SubmitSubmissionAsync(submission);
......
......@@ -21,15 +21,11 @@ public class Sender : FunctionalBaseClass {
throw new NotImplementedException();
}
/// <summary>
/// Encrypt attachments (Anhänge)
/// </summary>
/// <param name="attachment"></param>
/// <returns></returns>
public async Task<string> EncryptAttachment(string attachment, string publicKey) {
public async Task<string> Encrypt(string publicKey, byte[] attachment) {
throw new NotImplementedException();
}
/// <summary>
/// Create Metadata incl. Hash
/// </summary>
......@@ -50,11 +46,11 @@ public class Sender : FunctionalBaseClass {
}
/// <summary>
/// Encrypt Data (Fachdaten)
/// Encrypt Data
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public string EncryptDataAsync(string? data) {
public string Encrypt(string publicKey, string? data) {
if (data == null) return "";
throw new NotImplementedException();
}
......@@ -62,9 +58,10 @@ public class Sender : FunctionalBaseClass {
/// <summary>
/// Encrypt attachments (Anhänge)
/// </summary>
/// <param name="publicKey"></param>
/// <param name="attachment"></param>
/// <returns></returns>
public KeyValuePair<string, string> EncryptAttachment(Attachment attachment) {
public KeyValuePair<string, string> Encrypt(string publicKey, Attachment attachment) {
throw new NotImplementedException();
}
......
......@@ -35,18 +35,20 @@ public class Subscriber : FunctionalBaseClass {
/// <summary>
/// Decrypt Data (Fachdaten)
/// </summary>
/// <param name="privateKey"></param>
/// <param name="data">(Fachdaten)</param>
/// <returns></returns>
public async Task<string> DecryptDataAsync(string data) {
public async Task<string> DecryptToStringAsync(string privateKey, string data) {
throw new NotImplementedException();
}
/// <summary>
/// Decrypt attachments (Anhänge)
/// </summary>
/// <param name="attachment">Encrypted attachments</param>
/// <param name="privateKey"></param>
/// <param name="data">Encrypted attachments</param>
/// <returns></returns>
public async Task<byte[]> DecryptAttachmentAsync(string attachment) {
public async Task<byte[]> DecryptToBytesAsync(string privateKey, string data) {
throw new NotImplementedException();
}
......
......@@ -23,7 +23,7 @@ public class OAuthService {
/// <param name="clientSecret">Your client Secret</param>
/// <param name="scope">Scope if needed</param>
/// <returns>The received token or null</returns>
public async Task<OAuthAccessToken?> GetTokenAsync(string clientId, string clientSecret,
public async Task<OAuthAccessToken?> AuthenticateAsync(string clientId, string clientSecret,
string? scope = null) {
var client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment