function which must return a constructor args object for ctor. It
is passed true if the db needs to be cleaned up/unlinked before
opening it (OPFS) and false if not (how that is done is
- VFS-dependent). dbUnlink is a function which is expected to
- unlink() the db file if the ctorOpfFunc does not do so when
- passed true (kvvfs).
+ VFS-dependent). dbUnlink is a _synchronous_ function which is
+ expected to unlink() the db file if the ctorOpfFunc does not do
+ so when passed true (namely for kvvfs).
- This function initializes the db described by ctorOptFunc(...),
- writes some secret info into it, and re-opens it twice to
- confirm that it can be read with an SEE key and cannot be read
- without one.
+ This function initializes the db described by the result of
+ ctorOptFunc(bool), writes some secret info into it, and re-opens
+ it twice to confirm that it can be read with an SEE key and
+ cannot be read without one.
If unlinkDbAtEnd is truthy then dbUnlink() is (on success)
called before returning.
name: 'kvvfs SEE encryption in sessionStorage',
predicate: ()=>(!!globalThis.sessionStorage
|| "sessionStorage is not available"),
- test: function(sqlite3){
+ test: async function(sqlite3){
const JDb = sqlite3.oo1.JsStorageDb;
T.seeBaseCheck(JDb,
(isInit)=>{
.t({
name: '@vfsName@ with SEE encryption',
predicate: (sqlite3)=>!!sqlite3.oo1.@oo1Ctor@,
- test: function(sqlite3){
+ test: async function(sqlite3){
const ctor = sqlite3.oo1.@oo1Ctor@;
- T.seeBaseCheck(
- ctor,
- function(isInit){
- const opt = {filename: 'file:///sqlite3-see.edb'};
- if( isInit ) opt.filename += '?delete-before-open=1';
- return opt;
- },
- ()=>{}
- );
+ const filename = 'sqlite3-see.edb';
+ const ctorOpt = {filename: 'file:///'+filename};
+ const opfs = sqlite3.opfs;
+ const initer = function(isInit){
+ const opt = {...ctorOpt};
+ if( isInit ) opt.filename += '?delete-before-open=1';
+ return opt;
+ };
+
+ T.seeBaseCheck(ctor, initer, ()=>{}, false);
+ /*
+ Ensure that ctor.importDb() correctly handles SEE-encrypted
+ dbs. For more details search below for forumpost/f84bef3552.
+ */
+ let exp = await opfs.getRootDir()
+ .then(d=>d.getFileHandle(filename))
+ .then(fh=>fh.getFile())
+ .then(f=>f.bytes());
+ await opfs.unlink(filename);
+ T.assert( exp.byteLength > 100 && 0===(exp.byteLength % 512) );
+ const got = await ctor.importDb(filename, exp);
+ T.assert(exp.byteLength === got);
+ exp = null;
+ const db = new ctor({...initer(false), key: 'foo'});
+ try{
+ T.assert( 4 === db.selectValue("select count(*) from t") )
+ .assert( 6 === db.selectValue("select sum(a) from t") );
+ }finally{
+ db.close();
+ }
}
})
//#/if enable-see
false
);
/* Ensure that importDb() does the right thing for an
- SEE-encrypted DB:
- https://sqlite.org/see/forumpost/f84bef3552 */
+ SEE-encrypted DB: https://sqlite.org/see/forumpost/f84bef3552 */
let exp = poolUtil.exportFile(dbFile);
T.assert( exp.byteLength > 100 && 0===(exp.byteLength % 512) );
poolUtil.unlink(dbFile);
-C For\sthe\svarious\sOPFS\sVFS\sdb-import\sroutines,\sin\sSEE\sbuilds\s(only)\srelax\sthe\sis-this-a-db\scheck\sto\sallow\sfor\sSEE\sdbs\snot\shaving\sthe\susual\sheader\sstring\sin\scleartext.\sAddresses\s[https://sqlite.org/see/forumpost/f84bef3552|SEE\sforum\spost\sf84bef3552].
-D 2026-05-05T08:51:10.859
+C Add\simportDb()\stests\sof\sSEE\sdatabases\sfor\sthe\sopfs/opfs-wl\sVFSes,\sanalog\sto\sthe\sopfs-sahpool\stest\sin\s[a5a9ac7ad6622b].
+D 2026-05-05T15:26:24.464
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
F ext/wasm/tester1-worker.c-pp.html 7171022e7f4da8f46e5f50ea81dd6ce840b9235c47653a5deeb3764ccc2fe472
F ext/wasm/tester1.c-pp.html bd927ccf51ddd65e924660a0487add99e1b044afe03950e49d87ccf44efdddb6
-F ext/wasm/tester1.c-pp.js bb6ea310ff3daf2aaef99cffd0e0db2603736b49df8fbd1cf5b05fb165b63d62
+F ext/wasm/tester1.c-pp.js 803af078fe11b06482b5aa85d38478d2f37e9cdc3f85eacbeaea40c1b61359f1
F ext/wasm/tests/opfs/concurrency/index.html 706eab6308343c04ac2360aba6001af4ffaf46d8f33a0ccd02c64d93e3216a43
F ext/wasm/tests/opfs/concurrency/test.js 6919778fceaac1b7cc78caf41d796f545d2c4433b31188aa9689f05b5ad28828
F ext/wasm/tests/opfs/concurrency/worker.js 704d82c5e287e47f612349e027765943a58ad967dcf178fb5a1c3a8eaafb09af
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 97ab0a2fd56501d08bc2ab2adbe70a4130f6c5b5db343941fa16c7b34c550bd3
-R 7ba13c65bbee516d32510c18094784db
+P a5a9ac7ad6622b5b07193aa279deefde7d59ca17f81aba9dd78ee90718446993
+R 25cccb4d818ffb318cddd785d9828f48
U stephan
-Z 9cde2ed6511053725206d4ec3b114f5d
+Z 70c153abce31c38c75f7b3a78b65123e
# Remove this line to create a well-formed Fossil manifest.