WrappedKey.fromBytes constructor
Builds a WrappedKey from its toBytes encoding.
Implementation
factory WrappedKey.fromBytes(List<int> bytes) {
if (bytes.length < 32 + 12 + 16) {
throw ArgumentError.value(
bytes.length,
'bytes.length',
'a WrappedKey encoding is at least 60 bytes',
);
}
return WrappedKey(
ephemeralPublicKey: List<int>.unmodifiable(bytes.sublist(0, 32)),
nonce: List<int>.unmodifiable(bytes.sublist(32, 44)),
ciphertext: List<int>.unmodifiable(bytes.sublist(44)),
);
}