@@ -49,18 +49,18 @@ String _hmacJwkAlgFromHash(_Hash hash) {
49
49
throw UnsupportedError ('hash is not supported' );
50
50
}
51
51
52
- Future <HmacSecretKey > hmacSecretKey_importRawKey (
52
+ Future <HmacSecretKeyImpl > hmacSecretKey_importRawKey (
53
53
List <int > keyData,
54
54
Hash hash, {
55
55
int ? length,
56
56
}) async {
57
- return _HmacSecretKey (
57
+ return _HmacSecretKeyImpl (
58
58
_asUint8ListZeroedToBitLength (keyData, length),
59
59
_Hash .fromHash (hash),
60
60
);
61
61
}
62
62
63
- Future <HmacSecretKey > hmacSecretKey_importJsonWebKey (
63
+ Future <HmacSecretKeyImpl > hmacSecretKey_importJsonWebKey (
64
64
Map <String , dynamic > jwk,
65
65
Hash hash, {
66
66
int ? length,
@@ -86,7 +86,7 @@ Future<HmacSecretKey> hmacSecretKey_importJsonWebKey(
86
86
return hmacSecretKey_importRawKey (keyData, hash, length: length);
87
87
}
88
88
89
- Future <HmacSecretKey > hmacSecretKey_generateKey (
89
+ Future <HmacSecretKeyImpl > hmacSecretKey_generateKey (
90
90
Hash hash, {
91
91
int ? length,
92
92
}) async {
@@ -95,25 +95,44 @@ Future<HmacSecretKey> hmacSecretKey_generateKey(
95
95
final keyData = Uint8List ((length / 8 ).ceil ());
96
96
fillRandomBytes (keyData);
97
97
98
- return _HmacSecretKey (
98
+ return _HmacSecretKeyImpl (
99
99
_asUint8ListZeroedToBitLength (keyData, length),
100
100
h,
101
101
);
102
102
}
103
103
104
- class _HmacSecretKey implements HmacSecretKey {
104
+ final class _StaticHmacSecretKeyImpl implements StaticHmacSecretKeyImpl {
105
+ const _StaticHmacSecretKeyImpl ();
106
+
107
+ @override
108
+ Future <HmacSecretKeyImpl > importRawKey (List <int > keyData, Hash hash, {int ? length}) {
109
+ return hmacSecretKey_importRawKey (keyData, hash, length: length);
110
+ }
111
+
112
+ @override
113
+ Future <HmacSecretKeyImpl > importJsonWebKey (Map <String , dynamic > jwk, Hash hash, {int ? length}) {
114
+ return hmacSecretKey_importJsonWebKey (jwk, hash, length: length);
115
+ }
116
+
117
+ @override
118
+ Future <HmacSecretKeyImpl > generateKey (Hash hash, {int ? length = 32 }) {
119
+ return hmacSecretKey_generateKey (hash, length: length);
120
+ }
121
+ }
122
+
123
+ final class _HmacSecretKeyImpl implements HmacSecretKeyImpl {
105
124
final _Hash _hash;
106
125
final Uint8List _keyData;
107
126
108
- _HmacSecretKey (this ._keyData, this ._hash);
127
+ _HmacSecretKeyImpl (this ._keyData, this ._hash);
109
128
110
129
@override
111
130
String toString () {
112
- return 'Instance of \' HmacSecretKey \' ' ;
131
+ return 'Instance of \' HmacSecretKeyImpl \' ' ;
113
132
}
114
133
115
134
@override
116
- Future <Uint8List > signBytes (List <int > data) => signStream (Stream .value (data));
135
+ Future <Uint8List > signBytes (List <int > data) => signStream (Stream .value (data));
117
136
118
137
@override
119
138
Future <Uint8List > signStream (Stream <List <int >> data) {
0 commit comments