|
| 1 | +/// bindings for `libkeystore` |
| 2 | +
|
| 3 | +import 'dart:ffi'; |
| 4 | +import 'dart:io'; |
| 5 | +import 'package:ffi/ffi.dart' as ffi; |
| 6 | + |
| 7 | +// ignore_for_file: unused_import, camel_case_types, non_constant_identifier_names |
| 8 | +final DynamicLibrary _dl = _open(); |
| 9 | +DynamicLibrary _open() { |
| 10 | + if (Platform.isWindows) return DynamicLibrary.open('keystore.dll'); |
| 11 | + if (Platform.isAndroid) return DynamicLibrary.open('libkeystore.so'); |
| 12 | + if (Platform.isIOS) return DynamicLibrary.executable(); |
| 13 | + throw UnsupportedError('This platform is not supported.'); |
| 14 | +} |
| 15 | + |
| 16 | +/// C function `account_destroy`. |
| 17 | +void account_destroy( |
| 18 | + Pointer account, |
| 19 | +) { |
| 20 | + _account_destroy(account); |
| 21 | +} |
| 22 | +final _account_destroy_Dart _account_destroy = _dl.lookupFunction<_account_destroy_C, _account_destroy_Dart>('account_destroy'); |
| 23 | +typedef _account_destroy_C = Void Function( |
| 24 | + Pointer account, |
| 25 | +); |
| 26 | +typedef _account_destroy_Dart = void Function( |
| 27 | + Pointer account, |
| 28 | +); |
| 29 | + |
| 30 | +/// C function `error_message_utf8`. |
| 31 | +int error_message_utf8( |
| 32 | + Pointer<ffi.Utf8> buf, |
| 33 | + int length, |
| 34 | +) { |
| 35 | + return _error_message_utf8(buf, length); |
| 36 | +} |
| 37 | +final _error_message_utf8_Dart _error_message_utf8 = _dl.lookupFunction<_error_message_utf8_C, _error_message_utf8_Dart>('error_message_utf8'); |
| 38 | +typedef _error_message_utf8_C = Int32 Function( |
| 39 | + Pointer<ffi.Utf8> buf, |
| 40 | + Int32 length, |
| 41 | +); |
| 42 | +typedef _error_message_utf8_Dart = int Function( |
| 43 | + Pointer<ffi.Utf8> buf, |
| 44 | + int length, |
| 45 | +); |
| 46 | + |
| 47 | +/// C function `keystore_account`. |
| 48 | +Pointer keystore_account( |
| 49 | + Pointer keystore, |
| 50 | +) { |
| 51 | + return _keystore_account(keystore); |
| 52 | +} |
| 53 | +final _keystore_account_Dart _keystore_account = _dl.lookupFunction<_keystore_account_C, _keystore_account_Dart>('keystore_account'); |
| 54 | +typedef _keystore_account_C = Pointer Function( |
| 55 | + Pointer keystore, |
| 56 | +); |
| 57 | +typedef _keystore_account_Dart = Pointer Function( |
| 58 | + Pointer keystore, |
| 59 | +); |
| 60 | + |
| 61 | +/// C function `keystore_destroy`. |
| 62 | +void keystore_destroy( |
| 63 | + Pointer keystore, |
| 64 | +) { |
| 65 | + _keystore_destroy(keystore); |
| 66 | +} |
| 67 | +final _keystore_destroy_Dart _keystore_destroy = _dl.lookupFunction<_keystore_destroy_C, _keystore_destroy_Dart>('keystore_destroy'); |
| 68 | +typedef _keystore_destroy_C = Void Function( |
| 69 | + Pointer keystore, |
| 70 | +); |
| 71 | +typedef _keystore_destroy_Dart = void Function( |
| 72 | + Pointer keystore, |
| 73 | +); |
| 74 | + |
| 75 | +/// C function `keystore_from_keyfile`. |
| 76 | +Pointer keystore_from_keyfile( |
| 77 | + Pointer<ffi.Utf8> path, |
| 78 | +) { |
| 79 | + return _keystore_from_keyfile(path); |
| 80 | +} |
| 81 | +final _keystore_from_keyfile_Dart _keystore_from_keyfile = _dl.lookupFunction<_keystore_from_keyfile_C, _keystore_from_keyfile_Dart>('keystore_from_keyfile'); |
| 82 | +typedef _keystore_from_keyfile_C = Pointer Function( |
| 83 | + Pointer<ffi.Utf8> path, |
| 84 | +); |
| 85 | +typedef _keystore_from_keyfile_Dart = Pointer Function( |
| 86 | + Pointer<ffi.Utf8> path, |
| 87 | +); |
| 88 | + |
| 89 | +/// C function `keystore_generate`. |
| 90 | +int keystore_generate( |
| 91 | + Pointer keystore, |
| 92 | + Pointer<ffi.Utf8> password, |
| 93 | +) { |
| 94 | + return _keystore_generate(keystore, password); |
| 95 | +} |
| 96 | +final _keystore_generate_Dart _keystore_generate = _dl.lookupFunction<_keystore_generate_C, _keystore_generate_Dart>('keystore_generate'); |
| 97 | +typedef _keystore_generate_C = Int32 Function( |
| 98 | + Pointer keystore, |
| 99 | + Pointer<ffi.Utf8> password, |
| 100 | +); |
| 101 | +typedef _keystore_generate_Dart = int Function( |
| 102 | + Pointer keystore, |
| 103 | + Pointer<ffi.Utf8> password, |
| 104 | +); |
| 105 | + |
| 106 | +/// C function `keystore_import`. |
| 107 | +int keystore_import( |
| 108 | + Pointer keystore, |
| 109 | + Pointer<ffi.Utf8> phrase, |
| 110 | + Pointer<ffi.Utf8> password, |
| 111 | +) { |
| 112 | + return _keystore_import(keystore, phrase, password); |
| 113 | +} |
| 114 | +final _keystore_import_Dart _keystore_import = _dl.lookupFunction<_keystore_import_C, _keystore_import_Dart>('keystore_import'); |
| 115 | +typedef _keystore_import_C = Int32 Function( |
| 116 | + Pointer keystore, |
| 117 | + Pointer<ffi.Utf8> phrase, |
| 118 | + Pointer<ffi.Utf8> password, |
| 119 | +); |
| 120 | +typedef _keystore_import_Dart = int Function( |
| 121 | + Pointer keystore, |
| 122 | + Pointer<ffi.Utf8> phrase, |
| 123 | + Pointer<ffi.Utf8> password, |
| 124 | +); |
| 125 | + |
| 126 | +/// C function `keystore_lock`. |
| 127 | +int keystore_lock( |
| 128 | + Pointer keystore, |
| 129 | +) { |
| 130 | + return _keystore_lock(keystore); |
| 131 | +} |
| 132 | +final _keystore_lock_Dart _keystore_lock = _dl.lookupFunction<_keystore_lock_C, _keystore_lock_Dart>('keystore_lock'); |
| 133 | +typedef _keystore_lock_C = Int32 Function( |
| 134 | + Pointer keystore, |
| 135 | +); |
| 136 | +typedef _keystore_lock_Dart = int Function( |
| 137 | + Pointer keystore, |
| 138 | +); |
| 139 | + |
| 140 | +/// C function `keystore_new`. |
| 141 | +Pointer keystore_new() { |
| 142 | + return _keystore_new(); |
| 143 | +} |
| 144 | +final _keystore_new_Dart _keystore_new = _dl.lookupFunction<_keystore_new_C, _keystore_new_Dart>('keystore_new'); |
| 145 | +typedef _keystore_new_C = Pointer Function(); |
| 146 | +typedef _keystore_new_Dart = Pointer Function(); |
| 147 | + |
| 148 | +/// C function `keystore_paper_backup`. |
| 149 | +int keystore_paper_backup( |
| 150 | + Pointer keystore, |
| 151 | +) { |
| 152 | + return _keystore_paper_backup(keystore); |
| 153 | +} |
| 154 | +final _keystore_paper_backup_Dart _keystore_paper_backup = _dl.lookupFunction<_keystore_paper_backup_C, _keystore_paper_backup_Dart>('keystore_paper_backup'); |
| 155 | +typedef _keystore_paper_backup_C = Int32 Function( |
| 156 | + Pointer keystore, |
| 157 | +); |
| 158 | +typedef _keystore_paper_backup_Dart = int Function( |
| 159 | + Pointer keystore, |
| 160 | +); |
| 161 | + |
| 162 | +/// C function `keystore_phrase`. |
| 163 | +Pointer<ffi.Utf8> keystore_phrase( |
| 164 | + Pointer keystore, |
| 165 | + Pointer<ffi.Utf8> password, |
| 166 | +) { |
| 167 | + return _keystore_phrase(keystore, password); |
| 168 | +} |
| 169 | +final _keystore_phrase_Dart _keystore_phrase = _dl.lookupFunction<_keystore_phrase_C, _keystore_phrase_Dart>('keystore_phrase'); |
| 170 | +typedef _keystore_phrase_C = Pointer<ffi.Utf8> Function( |
| 171 | + Pointer keystore, |
| 172 | + Pointer<ffi.Utf8> password, |
| 173 | +); |
| 174 | +typedef _keystore_phrase_Dart = Pointer<ffi.Utf8> Function( |
| 175 | + Pointer keystore, |
| 176 | + Pointer<ffi.Utf8> password, |
| 177 | +); |
| 178 | + |
| 179 | +/// C function `keystore_set_paper_backup`. |
| 180 | +int keystore_set_paper_backup( |
| 181 | + Pointer keystore, |
| 182 | +) { |
| 183 | + return _keystore_set_paper_backup(keystore); |
| 184 | +} |
| 185 | +final _keystore_set_paper_backup_Dart _keystore_set_paper_backup = _dl.lookupFunction<_keystore_set_paper_backup_C, _keystore_set_paper_backup_Dart>('keystore_set_paper_backup'); |
| 186 | +typedef _keystore_set_paper_backup_C = Int32 Function( |
| 187 | + Pointer keystore, |
| 188 | +); |
| 189 | +typedef _keystore_set_paper_backup_Dart = int Function( |
| 190 | + Pointer keystore, |
| 191 | +); |
| 192 | + |
| 193 | +/// C function `keystore_status`. |
| 194 | +int keystore_status( |
| 195 | + Pointer keystore, |
| 196 | +) { |
| 197 | + return _keystore_status(keystore); |
| 198 | +} |
| 199 | +final _keystore_status_Dart _keystore_status = _dl.lookupFunction<_keystore_status_C, _keystore_status_Dart>('keystore_status'); |
| 200 | +typedef _keystore_status_C = Int32 Function( |
| 201 | + Pointer keystore, |
| 202 | +); |
| 203 | +typedef _keystore_status_Dart = int Function( |
| 204 | + Pointer keystore, |
| 205 | +); |
| 206 | + |
| 207 | +/// C function `keystore_unlock`. |
| 208 | +int keystore_unlock( |
| 209 | + Pointer keystore, |
| 210 | + Pointer<ffi.Utf8> password, |
| 211 | +) { |
| 212 | + return _keystore_unlock(keystore, password); |
| 213 | +} |
| 214 | +final _keystore_unlock_Dart _keystore_unlock = _dl.lookupFunction<_keystore_unlock_C, _keystore_unlock_Dart>('keystore_unlock'); |
| 215 | +typedef _keystore_unlock_C = Int32 Function( |
| 216 | + Pointer keystore, |
| 217 | + Pointer<ffi.Utf8> password, |
| 218 | +); |
| 219 | +typedef _keystore_unlock_Dart = int Function( |
| 220 | + Pointer keystore, |
| 221 | + Pointer<ffi.Utf8> password, |
| 222 | +); |
| 223 | + |
| 224 | +/// C function `last_error_length`. |
| 225 | +int last_error_length() { |
| 226 | + return _last_error_length(); |
| 227 | +} |
| 228 | +final _last_error_length_Dart _last_error_length = _dl.lookupFunction<_last_error_length_C, _last_error_length_Dart>('last_error_length'); |
| 229 | +typedef _last_error_length_C = Int32 Function(); |
| 230 | +typedef _last_error_length_Dart = int Function(); |
| 231 | + |
| 232 | +/// C function `phrase_destroy`. |
| 233 | +void phrase_destroy( |
| 234 | + Pointer<ffi.Utf8> phrase, |
| 235 | +) { |
| 236 | + _phrase_destroy(phrase); |
| 237 | +} |
| 238 | +final _phrase_destroy_Dart _phrase_destroy = _dl.lookupFunction<_phrase_destroy_C, _phrase_destroy_Dart>('phrase_destroy'); |
| 239 | +typedef _phrase_destroy_C = Void Function( |
| 240 | + Pointer<ffi.Utf8> phrase, |
| 241 | +); |
| 242 | +typedef _phrase_destroy_Dart = void Function( |
| 243 | + Pointer<ffi.Utf8> phrase, |
| 244 | +); |
| 245 | + |
| 246 | +/// C function `store_dart_post_cobject`. |
| 247 | +void store_dart_post_cobject( |
| 248 | + Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>> ptr, |
| 249 | +) { |
| 250 | + _store_dart_post_cobject(ptr); |
| 251 | +} |
| 252 | +final _store_dart_post_cobject_Dart _store_dart_post_cobject = _dl.lookupFunction<_store_dart_post_cobject_C, _store_dart_post_cobject_Dart>('store_dart_post_cobject'); |
| 253 | +typedef _store_dart_post_cobject_C = Void Function( |
| 254 | + Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>> ptr, |
| 255 | +); |
| 256 | +typedef _store_dart_post_cobject_Dart = void Function( |
| 257 | + Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>> ptr, |
| 258 | +); |
0 commit comments