Skip to content

Commit d758543

Browse files
committed
- Add Writerside documentation configuration and topics
- Enhance `README.md` with additional NuGet badges - Update CI workflow to configure SSH agent for authentication
1 parent 495d11e commit d758543

File tree

10 files changed

+146
-1
lines changed

10 files changed

+146
-1
lines changed

.github/workflows/publish.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ jobs:
2525
- name: Start Docker Compose services
2626
working-directory: ./src/NullOpsDevs.LibSsh.Test
2727
run: docker compose up -d
28+
29+
- name: Setup SSH Agent
30+
run: |
31+
eval $(ssh-agent -s)
32+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
33+
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
34+
cp src/NullOpsDevs.LibSsh.Test/docker/test-keys/id_rsa /tmp/id_rsa
35+
chmod 600 /tmp/id_rsa
36+
ssh-add /tmp/id_rsa
2837
2938
- name: Build test project (Release)
3039
run: dotnet build -c Release --self-contained -r linux-x64 ./src/NullOpsDevs.LibSsh.Test/NullOpsDevs.LibSsh.Test.csproj

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
A modern, cross-platform .NET library providing managed bindings for libssh2, enabling SSH operations including remote command execution, SCP file transfers, and advanced terminal (PTY) features.
44

5-
[![NuGet](https://img.shields.io/badge/nuget-1.0.0-blue.svg)](https://www.nuget.org/packages/NullOpsDevs.LibSsh/)
5+
[![NuGet](https://img.shields.io/nuget/v/NullOpsDevs.LibSsh)](https://www.nuget.org/packages/NullOpsDevs.LibSsh/)
6+
[![NuGet](https://img.shields.io/nuget/vpre/NullOpsDevs.LibSsh)](https://www.nuget.org/packages/NullOpsDevs.LibSsh/)
67
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
78
[![.NET](https://img.shields.io/badge/.NET-8.0-purple.svg)](https://dotnet.microsoft.com/)
89
[![.NET](https://img.shields.io/badge/.NET-9.0-purple.svg)](https://dotnet.microsoft.com/)

docs/Writerside/c.list

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE categories
3+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd">
4+
<categories>
5+
<category id="wrs" name="Writerside documentation" order="1"/>
6+
</categories>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE buildprofiles SYSTEM "https://resources.jetbrains.com/writerside/1.0/build-profiles.dtd">
3+
<buildprofiles xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
6+
<variables></variables>
7+
<build-profile instance="main">
8+
<variables>
9+
<noindex-content>false</noindex-content>
10+
</variables>
11+
</build-profile>
12+
13+
</buildprofiles>

docs/Writerside/main.tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE instance-profile
3+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">
4+
5+
<instance-profile id="main"
6+
name="LibSshNet"
7+
start-page="quickstart.md">
8+
9+
<toc-element topic="quickstart.md"/>
10+
<toc-element toc-title="Digging deeper"/>
11+
<toc-element topic="authentication.md"/>
12+
</instance-profile>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE rules SYSTEM "https://resources.jetbrains.com/writerside/1.0/redirection-rules.dtd">
3+
<rules>
4+
<!-- format is as follows
5+
<rule id="<unique id>">
6+
<accepts>page.html</accepts>
7+
</rule>
8+
-->
9+
<rule id="6ddf104">
10+
<description>Created after removal of "About main" from LibSshNet</description>
11+
<accepts>starter-topic.html</accepts>
12+
</rule>
13+
</rules>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Authentication
2+
3+
You can authenticate to a server using one of the following methods.
4+
5+
## Authenticate via username and password
6+
7+
```c#
8+
sshSession.Authenticate(SshCredential.FromPassword("user", "password"));
9+
```
10+
11+
## Host-based authentication
12+
13+
```c#
14+
sshSession.Authenticate(SshCredential.FromHostBased(
15+
"username",
16+
"~/.ssh/id_rsa.pub",
17+
"~/.ssh/id_rsa",
18+
"optional_passphrase",
19+
"hostname",
20+
"local username"));
21+
```
22+
23+
## Key-based authentication (file)
24+
25+
```c#
26+
sshSession.Authenticate(SshCredential.FromPublicKeyFile(
27+
"username",
28+
"~/.ssh/id_rsa.pub",
29+
"~/.ssh/id_rsa",
30+
"optional_passphrase"));
31+
```
32+
33+
## Key-based authentication (memory)
34+
35+
```c#
36+
sshSession.Authenticate(SshCredential.FromPublicKeyMemory(
37+
"username",
38+
new byte[]{ /* public key bytes */ },
39+
new byte[]{ /* private key bytes */},
40+
"optional_passphrase"));
41+
```
42+
43+
## Key-based authentication (agent)
44+
45+
```c#
46+
sshSession.Authenticate(SshCredential.FromAgent("username"));
47+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Quickstart
2+
3+
### 1. Install NuGet package
4+
5+
<tabs>
6+
<tab id="dotnet-CLI-install" title="dotnet CLI">
7+
<code-block lang="shell">
8+
dotnet add NullOpsDevs.LibSsh
9+
</code-block>
10+
</tab>
11+
<tab id="csproj-install" title=".csproj">
12+
<code-block lang="xml">
13+
&lt;ItemGroup&gt;
14+
&lt;PackageReference Include=&quot;NullOpsDevs.LibSsh&quot; Version=&quot;&lt;...&gt;&quot; /&gt;
15+
&lt;/ItemGroup&gt;
16+
</code-block>
17+
</tab>
18+
</tabs>
19+
20+
### 2. Connect to the server and execute some commands!
21+
22+
```c#
23+
using NullOpsDevs.LibSsh.Core;
24+
using NullOpsDevs.LibSsh.Credentials;
25+
26+
var ssh = new SshSession();
27+
ssh.Connect("localhost", 2222);
28+
ssh.Authenticate(SshCredential.FromPassword("user", "12345"));
29+
30+
Console.WriteLine(ssh.ExecuteCommand("ls").Stdout);
31+
```

docs/Writerside/v.list

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE vars SYSTEM "https://resources.jetbrains.com/writerside/1.0/vars.dtd">
3+
<vars>
4+
<var name="product" value="LibSshNet"/>
5+
</vars>

docs/Writerside/writerside.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE ihp SYSTEM "https://resources.jetbrains.com/writerside/1.0/ihp.dtd">
3+
4+
<ihp version="2.0">
5+
<topics dir="topics" web-path="topics"/>
6+
<images dir="images" web-path="images"/>
7+
<instance src="main.tree"/>
8+
</ihp>

0 commit comments

Comments
 (0)