planetarium / libplanet

Blockchain in C#/.NET for on-chain, decentralized gaming
https://docs.libplanet.io/
GNU Lesser General Public License v2.1
506 stars 139 forks source link

Abstracting out signing keys #2842

Open dahlia opened 1 year ago

dahlia commented 1 year ago

Currently we have only a concrete type to represent signing keys: PrivateKey. It assumes every signing key has its private part on memory, so Libplanet is difficult to utilize other signing facilities besides software-implemented ones. For example, transactions and blocks cannot be signed using secure enclaves.

In order to let various signing facilities integrate with Libplanet, we need to an abstraction layer in the middle. For example, it could look like this:

public interface ISignKey
{
    PublicKey PublicKey { get; }
    ImmutableArray<byte> Sign(ReadOnlySpan<byte> message);
}

public class PrivateKey : ISignKey
{
    // ...
}

It might be able to replace ICryptoBackend<T> as well.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.