using System; using Google.Protobuf; namespace FrostFS.SDK.Client.Mappers.GRPC; public static class SignatureMapper { public static Refs.Signature ToMessage(this FrostFsSignature signature) { if (signature is null) { throw new ArgumentNullException(nameof(signature)); } var scheme = signature.Scheme switch { SignatureScheme.EcdsaRfc6979Sha256 => Refs.SignatureScheme.EcdsaRfc6979Sha256, SignatureScheme.EcdsaRfc6979Sha256WalletConnect => Refs.SignatureScheme.EcdsaRfc6979Sha256WalletConnect, SignatureScheme.EcdsaSha512 => Refs.SignatureScheme.EcdsaSha512, _ => throw new ArgumentException(nameof(signature.Scheme), $"Unexpected enum value: {signature.Scheme}") }; return new Refs.Signature { Key = ByteString.CopyFrom(signature.Key), Scheme = scheme, Sign = ByteString.CopyFrom(signature.Sign) }; } }