Skip to content

Commit 907d864

Browse files
committed
Add Parsec authentication plugin implementation.
1 parent a64e5c4 commit 907d864

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Threading;
3+
4+
namespace MySqlConnector.Authentication.Ed25519;
5+
6+
/// <summary>
7+
/// Provides an implementation of the Parsec authentication plugin for MariaDB.
8+
/// </summary>
9+
public sealed class ParsecAuthenticationPlugin : IAuthenticationPlugin2
10+
{
11+
/// <summary>
12+
/// Registers the Parsec authentication plugin with MySqlConnector. You must call this method once before
13+
/// opening a connection that uses Parsec authentication.
14+
/// </summary>
15+
public static void Install()
16+
{
17+
if (Interlocked.CompareExchange(ref s_isInstalled, 1, 0) == 0)
18+
AuthenticationPlugins.Register(new ParsecAuthenticationPlugin());
19+
}
20+
21+
/// <summary>
22+
/// Gets the authentication plugin name.
23+
/// </summary>
24+
public string Name => "client_parsec"; // TODO: Update with correct name from parsec-spec.txt
25+
26+
/// <summary>
27+
/// Creates the authentication response.
28+
/// </summary>
29+
public byte[] CreateResponse(string password, ReadOnlySpan<byte> authenticationData)
30+
{
31+
// TODO: Implement Parsec authentication protocol
32+
throw new NotImplementedException();
33+
}
34+
35+
/// <summary>
36+
/// Creates the Parsec password hash.
37+
/// </summary>
38+
public byte[] CreatePasswordHash(string password, ReadOnlySpan<byte> authenticationData)
39+
{
40+
// TODO: Implement Parsec password hashing
41+
throw new NotImplementedException();
42+
}
43+
44+
private ParsecAuthenticationPlugin()
45+
{
46+
}
47+
48+
private static int s_isInstalled;
49+
}

0 commit comments

Comments
 (0)