Skip to content

Flutter plugin to create secure bookmarks to keep access to files in sandboxed apps.

License

Notifications You must be signed in to change notification settings

sbhamad/macos_secure_bookmarks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

macos_secure_bookmarks

Pub

Flutter plugin to create secure bookmarks to keep access to files in sandboxed apps.

Usage

Creating Security Scoped Bookmarks

// First let the user choose a file, e.g. using the file chooser plugin.

showOpenPanel((result, files) {
  if (result != FileChooserResult.ok || files.isEmpty) {
    return;
  }
  
  // Now create a security scoped bookmark
  final secureBookmarks = SecureBookmarks();
  final bookmark = await secureBookmarks.bookmark(File(_file));
  
  // Now store the bookmark somewhere for later invocations
});

Resolving and accessing bookmarks

// resolve bookmark from persistet 'bookmark' string from earlier
final resolvedFile = await _secureBookmarks.resolveBookmark(_bookmark);
// resolved is now a File object, but before accessing it, call:
await startAccessingSecurityScopedResource(resolvedFile);

// now read/write the file

// and later give up access.
await stopAccessingSecurityScopedResource(resolvedFile);

About

Flutter plugin to create secure bookmarks to keep access to files in sandboxed apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 51.7%
  • Swift 30.4%
  • Ruby 16.4%
  • Objective-C 1.5%