KS.Fiks.IO.Client
1.2.0
See the version list below for details.
dotnet add package KS.Fiks.IO.Client --version 1.2.0
NuGet\Install-Package KS.Fiks.IO.Client -Version 1.2.0
<PackageReference Include="KS.Fiks.IO.Client" Version="1.2.0" />
paket add KS.Fiks.IO.Client --version 1.2.0
#r "nuget: KS.Fiks.IO.Client, 1.2.0"
// Install KS.Fiks.IO.Client as a Cake Addin #addin nuget:?package=KS.Fiks.IO.Client&version=1.2.0 // Install KS.Fiks.IO.Client as a Cake Tool #tool nuget:?package=KS.Fiks.IO.Client&version=1.2.0
fiks-io-client-dotnet
.net library compatible with .Net Standard 2.0 for sending and receiving messages using Fiks IO.
Fiks IO is a messaging system for the public sector in Norway. About Fiks IO (Norwegian)
Installation
Install KS.Fiks.IO.Client nuget package in your .net project.
Prerequisites
To be able to use Fiks IO you have to have an active Fiks IO account with an associated integration. This can be setup for you organization at FIKS-Konfigurasjon (prod) or FIKS-Konfigurasjon (test).
Examples
Sending message
var client = new FiksIOClient(configuration); // See setup of configuration below
meldingRequest = new MeldingRequest(
avsenderKontoId: senderId, // Sender id as Guid
mottakerKontoId: receiverId, // Receiver id as Guid
meldingType: messageType); // Message type as string
// Sending a file
await client.Send(meldingRequest, "c:\path\someFile.pdf");
// Sending a string
await client.Send(meldingRequest, "String to send", "string.txt");
// Sending a stream
await client.Send(meldingRequest, someStream, "stream.jpg");
// Sending message without payload
await client.Send(meldingRequest);
Receiving message
Write zip to file
var client = new FiksIOClient(configuration); // See setup of configuration below
var onReceived = new EventHandler<MottattMeldingArgs>((sender, fileArgs) =>
{
if(fileArgs.Melding.HasPayload) { // Verify that message has payload
fileArgs.Melding.WriteDecryptedZip("c:\path\receivedFile.zip");
}
fileArgs.SvarSender.Ack() // Ack message if write succeeded to remove it from the queue
});
client.NewSubscription(onReceived);
Process archive as stream
var client = new FiksIOClient(configuration); // See setup of configuration below
var onReceived = new EventHandler<MottattMeldingArgs>((sender, fileArgs) =>
{
if(fileArgs.Melding.HasPayload) { // Verify that message has payload
using (var archiveAsStream = fileArgs.Melding.DecryptedStream)
{
// Process the stream
}
}
fileArgs.SvarSender.Ack() // Ack message if handling of stream succeeded to remove it from the queue
});
client.NewSubscription(onReceived);
Reply to message
You can reply directly to a message using the ReplySender.
var client = new FiksIOClient(configuration); // See setup of configuration below
var onReceived = new EventHandler<MottattMeldingArgs>((sender, fileArgs) =>
{
// Process the message
await fileArgs.SvarSender.Svar(/* message type */, /* message as string, path or stream */);
fileArgs.SvarSender.Ack() // Ack message to remove it from the queue
});
client.NewSubscription(onReceived);
Lookup
Using lookup, you can find which Fiks IO account to send a message to, given organization number, message type and access level needed to read the message.
var client = new FiksIOClient(configuration); // See setup of configuration below
var request = new LookupRequest(
identifikator: "ORG_NO.987654321",
meldingsprotokoll: "no.ks.test.fagsystem.v1",
sikkerhetsniva: 4);
var receiverKontoId = await client.Lookup(request);
Configuration
Two convenience functions are provided for generating default configurations for prod and test,
CreateMaskinportenProdConfig
and CreateMaskinportenTestConfig
. Only the required configuration parameters must be provided,
the rest will be set to default values for the given environment.
// Prod config
var config = FiksIOConfiguration.CreateProdConfiguration(
integrasjonId: integrationId,
integrasjonPassord: integrationPassord,
kontoId: kontoId,
privatNokkel: privatNokkel,
issuer: issuer, //klientid for maskinporten
certificate: certificat
);
// Test config
var config = FiksIOConfiguration.CreateTestConfiguration(
integrasjonId: integrationId,
integrasjonPassord: integrationPassord,
kontoId: kontoId,
privatNokkel: privatNokkel,
issuer: issuer, //klientid for maskinporten
certificate: certificat
);
If necessary, all parameters of configuration can be set in detail.
// Fiks IO account configuration
var kontoConfig = new KontoConfiguration(
kontoId: /* Fiks IO accountId as Guid */,
privatNokkel: /* Private key, paired with the public key supplied to Fiks IO account */);
// Id and password for integration associated to the Fiks IO account.
var integrasjonConfig = new IntegrasjonConfiguration(
integrasjonId: /* Integration id as Guid */,
integrasjonPassord: /* Integration password */);
// ID-porten machine to machine configuration
var maskinportenConfig = new MaskinportenClientConfiguration(
audience: @"https://oidc-ver2.difi.no/idporten-oidc-provider/", // ID-porten audience path
tokenEndpoint: @"https://oidc-ver2.difi.no/idporten-oidc-provider/token", // ID-porten token path
issuer: @"oidc_ks_test", //klientid for maskinporten
numberOfSecondsLeftBeforeExpire: 10, // The token will be refreshed 10 seconds before it expires
certificate: /* virksomhetssertifikat as a X509Certificate2 */);
// Optional: Use custom api host (i.e. for connecting to test api)
var apiConfig = new ApiConfiguration(
scheme: "https",
host: "api.fiks.test.ks.no",
port: 443);
// Optional: Use custom amqp host (i.e. for connection to test queue)
var amqp = new AmqpConfiguration(
host: "io.fiks.test.ks.no",
port: 5671);
// Combine all configurations
var configuration = new FiksIOConfiguration(kontoConfig, integrationConfig, maskinportenConfig, apiConfig, amqpConfig);
Public Key provider
By default when sending a message, the public key of the receiver will be fetched using the Catalog Api. If you instead need to provide the public key by some other means, you can implement the IPublicKeyProvider interface, and inject it when creating your client like this:
var client = new FiksIOClient(configuration, myPublicKeyProvider);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- KS.Fiks.ASiC-E (>= 1.0.3)
- KS.Fiks.Crypto (>= 1.0.4)
- KS.Fiks.IO.Send.Client (>= 1.0.7)
- KS.Fiks.Maskinporten.Client (>= 1.0.7)
- Newtonsoft.Json (>= 11.0.1 && <= 13.0.1)
- RabbitMQ.Client (>= 6.2.1)
-
.NETStandard 2.0
- KS.Fiks.ASiC-E (>= 1.0.3)
- KS.Fiks.Crypto (>= 1.0.4)
- KS.Fiks.IO.Send.Client (>= 1.0.7)
- KS.Fiks.Maskinporten.Client (>= 1.0.7)
- Newtonsoft.Json (>= 11.0.1 && <= 13.0.1)
- RabbitMQ.Client (>= 6.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.0.0 | 134 | 10/23/2024 |
4.0.7 | 2,221 | 9/25/2024 |
4.0.6 | 607 | 8/12/2024 |
4.0.5 | 9,541 | 4/23/2024 |
4.0.4 | 174 | 4/12/2024 |
4.0.3 | 1,714 | 1/24/2024 |
4.0.2 | 3,398 | 12/14/2023 |
4.0.1 | 7,342 | 11/28/2023 |
4.0.0 | 313 | 11/17/2023 |
3.0.8 | 1,689 | 10/3/2023 |
3.0.7 | 1,334 | 8/21/2023 |
3.0.6 | 435 | 5/31/2023 |
3.0.5 | 1,435 | 5/8/2023 |
3.0.4 | 212 | 5/3/2023 |
3.0.3 | 185 | 5/3/2023 |
3.0.2 | 24,290 | 1/24/2023 |
3.0.1 | 461 | 1/9/2023 |
3.0.0 | 346 | 1/8/2023 |
2.0.6 | 1,168 | 12/8/2022 |
2.0.5 | 437 | 11/30/2022 |
2.0.4 | 459 | 11/10/2022 |
2.0.3 | 491 | 10/31/2022 |
2.0.2 | 460 | 10/10/2022 |
2.0.1 | 562 | 9/28/2022 |
2.0.0 | 5,911 | 9/12/2022 |
1.2.11 | 13,346 | 6/28/2022 |
1.2.10 | 616 | 6/16/2022 |
1.2.9 | 2,759 | 5/10/2022 |
1.2.8 | 464 | 5/10/2022 |
1.2.7 | 561 | 5/9/2022 |
1.2.6 | 1,216 | 3/31/2022 |
1.2.5 | 605 | 2/17/2022 |
1.2.4 | 6,937 | 12/8/2021 |
1.2.3 | 3,235 | 8/11/2021 |
1.2.2 | 367 | 8/11/2021 |
1.2.1 | 680 | 6/17/2021 |
1.2.0 | 487 | 5/11/2021 |
1.1.13 | 836 | 2/24/2021 |
1.1.12 | 2,321 | 11/10/2020 |
1.1.11 | 431 | 11/10/2020 |
1.1.10 | 537 | 6/29/2020 |
1.1.9 | 516 | 3/26/2020 |
1.1.8 | 469 | 2/24/2020 |
1.1.7 | 514 | 2/19/2020 |
1.1.6 | 569 | 8/29/2019 |
1.1.5 | 549 | 8/29/2019 |
1.1.4 | 540 | 8/28/2019 |
1.1.3 | 564 | 8/5/2019 |
1.1.2 | 558 | 8/5/2019 |
1.1.1 | 559 | 6/25/2019 |
1.1.0 | 608 | 6/6/2019 |
1.0.4 | 582 | 6/6/2019 |
1.0.3 | 587 | 5/8/2019 |
1.0.2 | 593 | 5/7/2019 |
1.0.1 | 539 | 5/7/2019 |
1.0.0 | 580 | 5/6/2019 |
0.0.7 | 605 | 5/6/2019 |
0.0.7-build.20190430103905887 | 307 | 4/30/2019 |
0.0.7-build.20190430102329363 | 316 | 4/30/2019 |