Skip to content

Commit

Permalink
Always assume every browser has partitioned storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Nov 2, 2023
1 parent d670692 commit fd43bc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# authn.io ChangeLog

## 6.0.0 - 2023-11-dd

### Changed
- **BREAKING**: Always assume partitioned storage for every browser.

## 5.5.0 - 2023-08-15

### Changed
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@digitalbazaar/http-client": "^3.3.0",
"content-type": "^1.0.4",
"credential-mediator-polyfill": "^3.0.1",
"detect-browser": "^5.3.0",
"vue": "^3.2.47",
"vue-router": "^4.1.6",
"vue-web-request-mediator": "^6.0.1",
Expand Down
29 changes: 2 additions & 27 deletions web/mediator/platformDetection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,7 @@
* Copyright (c) 2017-2023, Digital Bazaar, Inc.
* All rights reserved.
*/
import {detect} from 'detect-browser';

const browser = detect();

let hasLocalStorage;
try {
hasLocalStorage = !!localStorage;
} catch(e) {
hasLocalStorage = false;
}

// specifically, branded Google Chrome, not just chromium
let isChrome;
try {
isChrome = browser?.name === 'chrome' &&
navigator.userAgentData?.brands.some(({brand}) => brand === 'Google Chrome');
} catch(e) {
isChrome = false;
}

// platform has partitioned storage if browser:
// 1. is Brave
// 2. is not Google Chrome
// 3. has no local storage
const _partitioned = !!(navigator.brave || !isChrome || !hasLocalStorage);

export function hasPartitionedStorage() {
return _partitioned;
// partitioned storage is now always used for every platform
return true;
}

0 comments on commit fd43bc2

Please sign in to comment.