test: function(sqlite3){
const dbFile = 'file:///sqlite3-see.edb';
const dbCtor = sqlite3.oo1.OpfsDb;
- //const tryKey = T.see.tryKey(dbCtor, dbFile);
const hexFoo = new Uint8Array([0x66,0x6f,0x6f]/*=="foo"*/);
let initDb = true;
const tryKey = function(keyKey, key, expectCount){
//console.debug('tryKey()',arguments);
const ctoropt = {
filename: dbFile,
- flags: 'ct'
+ flags: 'c'
};
try {
if (initDb) {
.assert(true === await u3.removeVfs())
.assert(false === await P3b.removeVfs());
}
- }/*OPFS SAH Pool sanity checks*/);
+ }/*OPFS SAH Pool sanity checks*/)
+//#if enable-see
+ .t({
+ name: 'OPFS SAHPool with SEE encryption',
+ test: async function(sqlite3){
+ const inst = sqlite3.installOpfsSAHPoolVfs,
+ catcher = (e)=>{
+ error("Cannot load SAH pool VFS.",
+ "This might not be a problem,",
+ "depending on the environment.");
+ return false;
+ };
+ const poolConfig = {
+ name: 'opfs-sahpool-see',
+ clearOnInit: true,
+ initialCapacity: 6
+ }
+ let poolUtil;
+ const P1 = await inst(poolConfig).then(u=>poolUtil = u).catch(catcher);
+ const dbFile = '/sqlite3-see.edb';
+ const dbCtor = poolUtil.OpfsSAHPoolDb;
+ const hexFoo = new Uint8Array([0x66,0x6f,0x6f]/*=="foo"*/);
+ let initDb = true;
+ const tryKey = function(keyKey, key, expectCount){
+ let db;
+ //console.debug('tryKey()',arguments);
+ const ctoropt = {
+ filename: dbFile,
+ flags: 'c'
+ };
+ try {
+ if (initDb) {
+ initDb = false;
+ poolUtil.unlink(dbFile);
+ db = new dbCtor({
+ ...ctoropt,
+ [keyKey]: key
+ });
+ db.exec([
+ "drop table if exists t;",
+ "create table t(a);"
+ ]);
+ db.close();
+ // Ensure that it's actually encrypted...
+ let err;
+ try {
+ db = new dbCtor(ctoropt);
+ T.assert(db, 'db opened') /* opening is fine, but... */;
+ const rv = db.exec({
+ sql:"select count(*) from sqlite_schema",
+ returnValue: 'resultRows'
+ });
+ console.warn("(should not be reached) rv =",rv);
+ } catch (e) {
+ err = e;
+ } finally {
+ db.close()
+ }
+ T.assert(err, "Expecting an exception")
+ .assert(sqlite3.capi.SQLITE_NOTADB == err.resultCode,
+ "Expecting NOTADB");
+ }/*initDb*/
+ db = new dbCtor({
+ ...ctoropt,
+ [keyKey]: key
+ });
+ db.exec("insert into t(a) values (1),(2)");
+ T.assert(expectCount === db.selectValue('select sum(a) from t'));
+ } finally {
+ if (db) db.close();
+ }
+ };
+ tryKey('textkey', 'foo', 3);
+ T.assert( !initDb );
+ tryKey('textkey', 'foo', 6);
+ initDb = true;
+ tryKey('key', 'foo', 3);
+ T.assert( !initDb );
+ tryKey('key', hexFoo, 6);
+ initDb = true;
+ tryKey('hexkey', hexFoo, 3);
+ T.assert( !initDb );
+ tryKey('hexkey', hexFoo, 6);
+ poolUtil.removeVfs();
+ }
+ })/*opfs-sahpool with SEE*/
+//#endif enable-see
+ ;
////////////////////////////////////////////////////////////////////////
T.g('Misc. APIs')
-C Add\sa\stest\swhich\suses\sSEE\svia\sthe\s"opfs"\sVFS.\s"opfs-sahpool"\sis\spending.
-D 2025-10-26T21:30:29.030
+C Demonstrate\sthe\sopfs-sahpool\sVFS\swith\sSEE.
+D 2025-10-26T21:45:02.188
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 0e432ec2c0d99cd470484337066e8d27e7aee4641d97115338f7d962bf7b081a
F ext/wasm/tester1.c-pp.html 52d88fe2c6f21a046030a36410b4839b632f4424028197a45a3d5669ea724ddb
-F ext/wasm/tester1.c-pp.js 0682483659dac54c191fbde8da5a3d3f8ac3ecb179992d9544c831aee6e0c2ff
+F ext/wasm/tester1.c-pp.js 2b014884dadf28928fabcb688746ca87145673eef75e154486505a266203fc15
F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P be5d2bae508a681628d4f84528e37db4e8a39b16e580b0d6ab4cd844566e973f
-R 12a327fb75e225680a269e09a068873c
+P 1eb5a7ea394aa5b7e8594d73ce31f4b9bef55f2fa977dc26810c0bfba1cc39f7
+R ad24e4d776c0642a4338f3a9a03fa5cb
U stephan
-Z 94bce14188186930742f8654664cdf9f
+Z f8799f7567d58ff6658a16b74cf1ecfb
# Remove this line to create a well-formed Fossil manifest.