insertKey method
Inserts a new key into the store.
Throws an AskarSessionException if the session is closed.
Implementation
Future<void> insertKey({
required String name,
required Key key,
String? metadata,
Map<String, dynamic>? tags,
int? expiryMs,
}) async {
_throwOnNullHandle('Cannot insert a key with a closed session');
try {
final insertKeyResult = await askarSessionInsertKey(
handle!,
key.handle,
name,
metadata: metadata,
tags: tags,
expiryMs: expiryMs,
);
insertKeyResult.errorCode.throwOnError();
} catch (e) {
throw AskarSessionException('Failed to insert key on session: $e');
}
}