@@ -30,7 +30,7 @@ namespace Libplanet.Crypto
30
30
public class BlsPrivateKey : IEquatable < BlsPrivateKey > , IPrivateKey
31
31
{
32
32
private const int KeyByteSize = BLS . SECRETKEY_SERIALIZE_SIZE ;
33
- private readonly IReadOnlyList < byte > _privateKey ;
33
+ private readonly ImmutableArray < byte > _privateKey ;
34
34
private BlsPublicKey ? _publicKey ;
35
35
private BlsSignature ? _proofOfPossession ;
36
36
@@ -40,7 +40,8 @@ public class BlsPrivateKey : IEquatable<BlsPrivateKey>, IPrivateKey
40
40
/// </summary>
41
41
public BlsPrivateKey ( )
42
42
{
43
- _privateKey = CryptoConfig . ConsensusCryptoBackend . GeneratePrivateKey ( ) ;
43
+ _privateKey = CryptoConfig . ConsensusCryptoBackend . GeneratePrivateKey ( )
44
+ . ToImmutableArray ( ) ;
44
45
_proofOfPossession = CryptoConfig . ConsensusCryptoBackend . GetProofOfPossession ( this ) ;
45
46
}
46
47
@@ -81,7 +82,7 @@ public BlsPrivateKey(IReadOnlyList<byte> privateKey)
81
82
nameof ( privateKey ) ) ;
82
83
}
83
84
84
- _privateKey = privateKey ;
85
+ _privateKey = privateKey . ToImmutableArray ( ) ;
85
86
_ = CryptoConfig . ConsensusCryptoBackend . ValidateGetNativePrivateKey ( this ) ;
86
87
_proofOfPossession = CryptoConfig . ConsensusCryptoBackend . GetProofOfPossession ( this ) ;
87
88
}
@@ -113,7 +114,7 @@ public BlsPublicKey PublicKey
113
114
114
115
IPublicKey IPrivateKey . PublicKey => PublicKey ;
115
116
116
- IReadOnlyList < byte > IPrivateKey . KeyBytes => ByteArray ;
117
+ ImmutableArray < byte > IPrivateKey . KeyBytes => ByteArray ;
117
118
118
119
/// <summary>
119
120
/// Returns the corresponding Proof of Possession. Public key can be aggregated, some public
0 commit comments