@chipmobilesdk/rn-local-db 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +137 -0
- package/README.md +69 -8
- package/lib/commonjs/adapter/budgets.js +79 -0
- package/lib/commonjs/adapter/budgets.js.map +1 -0
- package/lib/commonjs/adapter/collection.js +236 -0
- package/lib/commonjs/adapter/collection.js.map +1 -0
- package/lib/commonjs/adapter/deletion.js +291 -0
- package/lib/commonjs/adapter/deletion.js.map +1 -0
- package/lib/commonjs/adapter/handle.js +259 -0
- package/lib/commonjs/adapter/handle.js.map +1 -0
- package/lib/commonjs/adapter/index.js +67 -0
- package/lib/commonjs/adapter/index.js.map +1 -0
- package/lib/commonjs/adapter/lifecycle.js +176 -0
- package/lib/commonjs/adapter/lifecycle.js.map +1 -0
- package/lib/commonjs/adapter/schema-sync.js +124 -0
- package/lib/commonjs/adapter/schema-sync.js.map +1 -0
- package/lib/commonjs/adapter/transaction.js +58 -0
- package/lib/commonjs/adapter/transaction.js.map +1 -0
- package/lib/commonjs/artifacts/availability.js +90 -0
- package/lib/commonjs/artifacts/availability.js.map +1 -0
- package/lib/commonjs/artifacts/cascade.js +80 -0
- package/lib/commonjs/artifacts/cascade.js.map +1 -0
- package/lib/commonjs/artifacts/paths.js +31 -0
- package/lib/commonjs/artifacts/paths.js.map +1 -0
- package/lib/commonjs/artifacts/reconcile.js +55 -0
- package/lib/commonjs/artifacts/reconcile.js.map +1 -0
- package/lib/commonjs/artifacts/store.js +300 -0
- package/lib/commonjs/artifacts/store.js.map +1 -0
- package/lib/commonjs/contract/adapter.js +6 -0
- package/lib/commonjs/contract/adapter.js.map +1 -0
- package/lib/commonjs/contract/attachment.js +2 -0
- package/lib/commonjs/contract/attachment.js.map +1 -0
- package/lib/commonjs/contract/backup.js +2 -0
- package/lib/commonjs/contract/backup.js.map +1 -0
- package/lib/commonjs/contract/config.js +31 -0
- package/lib/commonjs/contract/config.js.map +1 -0
- package/lib/commonjs/contract/encryption.js +6 -0
- package/lib/commonjs/contract/encryption.js.map +1 -0
- package/lib/commonjs/contract/errors.js +64 -0
- package/lib/commonjs/contract/errors.js.map +1 -0
- package/lib/commonjs/contract/migration.js +6 -0
- package/lib/commonjs/contract/migration.js.map +1 -0
- package/lib/commonjs/contract/query.js +6 -0
- package/lib/commonjs/contract/query.js.map +1 -0
- package/lib/commonjs/contract/record.js +6 -0
- package/lib/commonjs/contract/record.js.map +1 -0
- package/lib/commonjs/contract/schema.js +2 -0
- package/lib/commonjs/contract/schema.js.map +1 -0
- package/lib/commonjs/contract/scope.js +2 -0
- package/lib/commonjs/contract/scope.js.map +1 -0
- package/lib/commonjs/contract/transaction.js +6 -0
- package/lib/commonjs/contract/transaction.js.map +1 -0
- package/lib/commonjs/crypto/chunked-cipher.js +147 -0
- package/lib/commonjs/crypto/chunked-cipher.js.map +1 -0
- package/lib/commonjs/crypto/derive.js +61 -0
- package/lib/commonjs/crypto/derive.js.map +1 -0
- package/lib/commonjs/crypto/key-provider.js +70 -0
- package/lib/commonjs/crypto/key-provider.js.map +1 -0
- package/lib/commonjs/crypto/provider.js +54 -0
- package/lib/commonjs/crypto/provider.js.map +1 -0
- package/lib/commonjs/diagnostics/dev-log.js +127 -0
- package/lib/commonjs/diagnostics/dev-log.js.map +1 -0
- package/lib/commonjs/diagnostics/errors.js +57 -0
- package/lib/commonjs/diagnostics/errors.js.map +1 -0
- package/lib/commonjs/diagnostics/faults.js +54 -0
- package/lib/commonjs/diagnostics/faults.js.map +1 -0
- package/lib/commonjs/diagnostics/map-native.js +98 -0
- package/lib/commonjs/diagnostics/map-native.js.map +1 -0
- package/lib/commonjs/diagnostics/redact.js +110 -0
- package/lib/commonjs/diagnostics/redact.js.map +1 -0
- package/lib/commonjs/index.js +70 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/migration/executor.js +136 -0
- package/lib/commonjs/migration/executor.js.map +1 -0
- package/lib/commonjs/migration/ledger.js +64 -0
- package/lib/commonjs/migration/ledger.js.map +1 -0
- package/lib/commonjs/migration/validate-chain.js +76 -0
- package/lib/commonjs/migration/validate-chain.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/platform/backup-android-verify.js +76 -0
- package/lib/commonjs/platform/backup-android-verify.js.map +1 -0
- package/lib/commonjs/platform/backup-ios.js +50 -0
- package/lib/commonjs/platform/backup-ios.js.map +1 -0
- package/lib/commonjs/platform/bytes.js +158 -0
- package/lib/commonjs/platform/bytes.js.map +1 -0
- package/lib/commonjs/platform/fs.js +59 -0
- package/lib/commonjs/platform/fs.js.map +1 -0
- package/lib/commonjs/platform/location.js +129 -0
- package/lib/commonjs/platform/location.js.map +1 -0
- package/lib/commonjs/query/budgets.js +95 -0
- package/lib/commonjs/query/budgets.js.map +1 -0
- package/lib/commonjs/query/compare.js +97 -0
- package/lib/commonjs/query/compare.js.map +1 -0
- package/lib/commonjs/query/cursor.js +97 -0
- package/lib/commonjs/query/cursor.js.map +1 -0
- package/lib/commonjs/query/filter.js +82 -0
- package/lib/commonjs/query/filter.js.map +1 -0
- package/lib/commonjs/query/paginate.js +48 -0
- package/lib/commonjs/query/paginate.js.map +1 -0
- package/lib/commonjs/query/sort.js +61 -0
- package/lib/commonjs/query/sort.js.map +1 -0
- package/lib/commonjs/query/validate.js +180 -0
- package/lib/commonjs/query/validate.js.map +1 -0
- package/lib/commonjs/schema/declare.js +47 -0
- package/lib/commonjs/schema/declare.js.map +1 -0
- package/lib/commonjs/schema/validate-config.js +115 -0
- package/lib/commonjs/schema/validate-config.js.map +1 -0
- package/lib/commonjs/scope/hash.js +107 -0
- package/lib/commonjs/scope/hash.js.map +1 -0
- package/lib/commonjs/scope/normalize.js +73 -0
- package/lib/commonjs/scope/normalize.js.map +1 -0
- package/lib/commonjs/scope/validate.js +81 -0
- package/lib/commonjs/scope/validate.js.map +1 -0
- package/lib/commonjs/sqlite/adapter.js +31 -0
- package/lib/commonjs/sqlite/adapter.js.map +1 -0
- package/lib/commonjs/sqlite/batch.js +218 -0
- package/lib/commonjs/sqlite/batch.js.map +1 -0
- package/lib/commonjs/sqlite/catalog.js +81 -0
- package/lib/commonjs/sqlite/catalog.js.map +1 -0
- package/lib/commonjs/sqlite/connection.js +210 -0
- package/lib/commonjs/sqlite/connection.js.map +1 -0
- package/lib/commonjs/sqlite/index-coverage.js +42 -0
- package/lib/commonjs/sqlite/index-coverage.js.map +1 -0
- package/lib/commonjs/sqlite/native.js +54 -0
- package/lib/commonjs/sqlite/native.js.map +1 -0
- package/lib/commonjs/sqlite/row-codec.js +192 -0
- package/lib/commonjs/sqlite/row-codec.js.map +1 -0
- package/lib/commonjs/sqlite/sql-builder.js +253 -0
- package/lib/commonjs/sqlite/sql-builder.js.map +1 -0
- package/lib/commonjs/sqlite/statements.js +54 -0
- package/lib/commonjs/sqlite/statements.js.map +1 -0
- package/lib/commonjs/sqlite/transaction-queue.js +79 -0
- package/lib/commonjs/sqlite/transaction-queue.js.map +1 -0
- package/lib/commonjs/sqlite/transactions.js +33 -0
- package/lib/commonjs/sqlite/transactions.js.map +1 -0
- package/lib/commonjs/sqlite/values.js +31 -0
- package/lib/commonjs/sqlite/values.js.map +1 -0
- package/lib/commonjs/testing/conformance/attachments.js +180 -0
- package/lib/commonjs/testing/conformance/attachments.js.map +1 -0
- package/lib/commonjs/testing/conformance/encryption.js +187 -0
- package/lib/commonjs/testing/conformance/encryption.js.map +1 -0
- package/lib/commonjs/testing/conformance/index.js +103 -0
- package/lib/commonjs/testing/conformance/index.js.map +1 -0
- package/lib/commonjs/testing/conformance/lifecycle.js +134 -0
- package/lib/commonjs/testing/conformance/lifecycle.js.map +1 -0
- package/lib/commonjs/testing/conformance/migrations.js +167 -0
- package/lib/commonjs/testing/conformance/migrations.js.map +1 -0
- package/lib/commonjs/testing/conformance/queries.js +278 -0
- package/lib/commonjs/testing/conformance/queries.js.map +1 -0
- package/lib/commonjs/testing/conformance/records.js +224 -0
- package/lib/commonjs/testing/conformance/records.js.map +1 -0
- package/lib/commonjs/testing/conformance/scopes.js +107 -0
- package/lib/commonjs/testing/conformance/scopes.js.map +1 -0
- package/lib/commonjs/testing/conformance/transactions.js +228 -0
- package/lib/commonjs/testing/conformance/transactions.js.map +1 -0
- package/lib/commonjs/testing/faults.js +38 -0
- package/lib/commonjs/testing/faults.js.map +1 -0
- package/lib/commonjs/testing/index.js +59 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/attachments.js +145 -0
- package/lib/commonjs/testing/memory-adapter/attachments.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/collection.js +224 -0
- package/lib/commonjs/testing/memory-adapter/collection.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/index.js +366 -0
- package/lib/commonjs/testing/memory-adapter/index.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/migrations.js +126 -0
- package/lib/commonjs/testing/memory-adapter/migrations.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/reset.js +49 -0
- package/lib/commonjs/testing/memory-adapter/reset.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/store.js +107 -0
- package/lib/commonjs/testing/memory-adapter/store.js.map +1 -0
- package/lib/module/adapter/budgets.js +51 -0
- package/lib/module/adapter/budgets.js.map +1 -0
- package/lib/module/adapter/collection.js +232 -0
- package/lib/module/adapter/collection.js.map +1 -0
- package/lib/module/adapter/deletion.js +280 -0
- package/lib/module/adapter/deletion.js.map +1 -0
- package/lib/module/adapter/handle.js +254 -0
- package/lib/module/adapter/handle.js.map +1 -0
- package/lib/module/adapter/index.js +59 -0
- package/lib/module/adapter/index.js.map +1 -0
- package/lib/module/adapter/lifecycle.js +172 -0
- package/lib/module/adapter/lifecycle.js.map +1 -0
- package/lib/module/adapter/schema-sync.js +121 -0
- package/lib/module/adapter/schema-sync.js.map +1 -0
- package/lib/module/adapter/transaction.js +54 -0
- package/lib/module/adapter/transaction.js.map +1 -0
- package/lib/module/artifacts/availability.js +86 -0
- package/lib/module/artifacts/availability.js.map +1 -0
- package/lib/module/artifacts/cascade.js +75 -0
- package/lib/module/artifacts/cascade.js.map +1 -0
- package/lib/module/artifacts/paths.js +26 -0
- package/lib/module/artifacts/paths.js.map +1 -0
- package/lib/module/artifacts/reconcile.js +51 -0
- package/lib/module/artifacts/reconcile.js.map +1 -0
- package/lib/module/artifacts/store.js +289 -0
- package/lib/module/artifacts/store.js.map +1 -0
- package/lib/module/contract/adapter.js +4 -0
- package/lib/module/contract/adapter.js.map +1 -0
- package/lib/module/contract/attachment.js +2 -0
- package/lib/module/contract/attachment.js.map +1 -0
- package/lib/module/contract/backup.js +2 -0
- package/lib/module/contract/backup.js.map +1 -0
- package/lib/module/contract/config.js +27 -0
- package/lib/module/contract/config.js.map +1 -0
- package/lib/module/contract/encryption.js +4 -0
- package/lib/module/contract/encryption.js.map +1 -0
- package/lib/module/contract/errors.js +60 -0
- package/lib/module/contract/errors.js.map +1 -0
- package/lib/module/contract/migration.js +4 -0
- package/lib/module/contract/migration.js.map +1 -0
- package/lib/module/contract/query.js +4 -0
- package/lib/module/contract/query.js.map +1 -0
- package/lib/module/contract/record.js +4 -0
- package/lib/module/contract/record.js.map +1 -0
- package/lib/module/contract/schema.js +2 -0
- package/lib/module/contract/schema.js.map +1 -0
- package/lib/module/contract/scope.js +2 -0
- package/lib/module/contract/scope.js.map +1 -0
- package/lib/module/contract/transaction.js +4 -0
- package/lib/module/contract/transaction.js.map +1 -0
- package/lib/module/crypto/chunked-cipher.js +134 -0
- package/lib/module/crypto/chunked-cipher.js.map +1 -0
- package/lib/module/crypto/derive.js +56 -0
- package/lib/module/crypto/derive.js.map +1 -0
- package/lib/module/crypto/key-provider.js +67 -0
- package/lib/module/crypto/key-provider.js.map +1 -0
- package/lib/module/crypto/provider.js +49 -0
- package/lib/module/crypto/provider.js.map +1 -0
- package/lib/module/diagnostics/dev-log.js +120 -0
- package/lib/module/diagnostics/dev-log.js.map +1 -0
- package/lib/module/diagnostics/errors.js +44 -0
- package/lib/module/diagnostics/errors.js.map +1 -0
- package/lib/module/diagnostics/faults.js +47 -0
- package/lib/module/diagnostics/faults.js.map +1 -0
- package/lib/module/diagnostics/map-native.js +93 -0
- package/lib/module/diagnostics/map-native.js.map +1 -0
- package/lib/module/diagnostics/redact.js +102 -0
- package/lib/module/diagnostics/redact.js.map +1 -0
- package/lib/module/index.js +28 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/migration/executor.js +132 -0
- package/lib/module/migration/executor.js.map +1 -0
- package/lib/module/migration/ledger.js +57 -0
- package/lib/module/migration/ledger.js.map +1 -0
- package/lib/module/migration/validate-chain.js +70 -0
- package/lib/module/migration/validate-chain.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/platform/backup-android-verify.js +69 -0
- package/lib/module/platform/backup-android-verify.js.map +1 -0
- package/lib/module/platform/backup-ios.js +44 -0
- package/lib/module/platform/backup-ios.js.map +1 -0
- package/lib/module/platform/bytes.js +148 -0
- package/lib/module/platform/bytes.js.map +1 -0
- package/lib/module/platform/fs.js +54 -0
- package/lib/module/platform/fs.js.map +1 -0
- package/lib/module/platform/location.js +120 -0
- package/lib/module/platform/location.js.map +1 -0
- package/lib/module/query/budgets.js +88 -0
- package/lib/module/query/budgets.js.map +1 -0
- package/lib/module/query/compare.js +90 -0
- package/lib/module/query/compare.js.map +1 -0
- package/lib/module/query/cursor.js +91 -0
- package/lib/module/query/cursor.js.map +1 -0
- package/lib/module/query/filter.js +78 -0
- package/lib/module/query/filter.js.map +1 -0
- package/lib/module/query/paginate.js +40 -0
- package/lib/module/query/paginate.js.map +1 -0
- package/lib/module/query/sort.js +53 -0
- package/lib/module/query/sort.js.map +1 -0
- package/lib/module/query/validate.js +173 -0
- package/lib/module/query/validate.js.map +1 -0
- package/lib/module/schema/declare.js +37 -0
- package/lib/module/schema/declare.js.map +1 -0
- package/lib/module/schema/validate-config.js +111 -0
- package/lib/module/schema/validate-config.js.map +1 -0
- package/lib/module/scope/hash.js +102 -0
- package/lib/module/scope/hash.js.map +1 -0
- package/lib/module/scope/normalize.js +67 -0
- package/lib/module/scope/normalize.js.map +1 -0
- package/lib/module/scope/validate.js +76 -0
- package/lib/module/scope/validate.js.map +1 -0
- package/lib/module/sqlite/adapter.js +27 -0
- package/lib/module/sqlite/adapter.js.map +1 -0
- package/lib/module/sqlite/batch.js +214 -0
- package/lib/module/sqlite/batch.js.map +1 -0
- package/lib/module/sqlite/catalog.js +72 -0
- package/lib/module/sqlite/catalog.js.map +1 -0
- package/lib/module/sqlite/connection.js +206 -0
- package/lib/module/sqlite/connection.js.map +1 -0
- package/lib/module/sqlite/index-coverage.js +38 -0
- package/lib/module/sqlite/index-coverage.js.map +1 -0
- package/lib/module/sqlite/native.js +48 -0
- package/lib/module/sqlite/native.js.map +1 -0
- package/lib/module/sqlite/row-codec.js +176 -0
- package/lib/module/sqlite/row-codec.js.map +1 -0
- package/lib/module/sqlite/sql-builder.js +247 -0
- package/lib/module/sqlite/sql-builder.js.map +1 -0
- package/lib/module/sqlite/statements.js +49 -0
- package/lib/module/sqlite/statements.js.map +1 -0
- package/lib/module/sqlite/transaction-queue.js +75 -0
- package/lib/module/sqlite/transaction-queue.js.map +1 -0
- package/lib/module/sqlite/transactions.js +29 -0
- package/lib/module/sqlite/transactions.js.map +1 -0
- package/lib/module/sqlite/values.js +24 -0
- package/lib/module/sqlite/values.js.map +1 -0
- package/lib/module/testing/conformance/attachments.js +176 -0
- package/lib/module/testing/conformance/attachments.js.map +1 -0
- package/lib/module/testing/conformance/encryption.js +183 -0
- package/lib/module/testing/conformance/encryption.js.map +1 -0
- package/lib/module/testing/conformance/index.js +97 -0
- package/lib/module/testing/conformance/index.js.map +1 -0
- package/lib/module/testing/conformance/lifecycle.js +130 -0
- package/lib/module/testing/conformance/lifecycle.js.map +1 -0
- package/lib/module/testing/conformance/migrations.js +163 -0
- package/lib/module/testing/conformance/migrations.js.map +1 -0
- package/lib/module/testing/conformance/queries.js +274 -0
- package/lib/module/testing/conformance/queries.js.map +1 -0
- package/lib/module/testing/conformance/records.js +220 -0
- package/lib/module/testing/conformance/records.js.map +1 -0
- package/lib/module/testing/conformance/scopes.js +103 -0
- package/lib/module/testing/conformance/scopes.js.map +1 -0
- package/lib/module/testing/conformance/transactions.js +224 -0
- package/lib/module/testing/conformance/transactions.js.map +1 -0
- package/lib/module/testing/faults.js +16 -0
- package/lib/module/testing/faults.js.map +1 -0
- package/lib/module/testing/index.js +16 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/memory-adapter/attachments.js +142 -0
- package/lib/module/testing/memory-adapter/attachments.js.map +1 -0
- package/lib/module/testing/memory-adapter/collection.js +220 -0
- package/lib/module/testing/memory-adapter/collection.js.map +1 -0
- package/lib/module/testing/memory-adapter/index.js +351 -0
- package/lib/module/testing/memory-adapter/index.js.map +1 -0
- package/lib/module/testing/memory-adapter/migrations.js +122 -0
- package/lib/module/testing/memory-adapter/migrations.js.map +1 -0
- package/lib/module/testing/memory-adapter/reset.js +44 -0
- package/lib/module/testing/memory-adapter/reset.js.map +1 -0
- package/lib/module/testing/memory-adapter/store.js +94 -0
- package/lib/module/testing/memory-adapter/store.js.map +1 -0
- package/lib/typescript/commonjs/adapter/budgets.d.ts +19 -0
- package/lib/typescript/commonjs/adapter/budgets.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/collection.d.ts +25 -0
- package/lib/typescript/commonjs/adapter/collection.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/deletion.d.ts +48 -0
- package/lib/typescript/commonjs/adapter/deletion.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/handle.d.ts +30 -0
- package/lib/typescript/commonjs/adapter/handle.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/index.d.ts +30 -0
- package/lib/typescript/commonjs/adapter/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/lifecycle.d.ts +25 -0
- package/lib/typescript/commonjs/adapter/lifecycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/schema-sync.d.ts +19 -0
- package/lib/typescript/commonjs/adapter/schema-sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/transaction.d.ts +32 -0
- package/lib/typescript/commonjs/adapter/transaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/availability.d.ts +19 -0
- package/lib/typescript/commonjs/artifacts/availability.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/cascade.d.ts +26 -0
- package/lib/typescript/commonjs/artifacts/cascade.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/paths.d.ts +16 -0
- package/lib/typescript/commonjs/artifacts/paths.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/reconcile.d.ts +23 -0
- package/lib/typescript/commonjs/artifacts/reconcile.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/store.d.ts +45 -0
- package/lib/typescript/commonjs/artifacts/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/adapter.d.ts +55 -0
- package/lib/typescript/commonjs/contract/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/attachment.d.ts +84 -0
- package/lib/typescript/commonjs/contract/attachment.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/backup.d.ts +26 -0
- package/lib/typescript/commonjs/contract/backup.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/config.d.ts +50 -0
- package/lib/typescript/commonjs/contract/config.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/encryption.d.ts +31 -0
- package/lib/typescript/commonjs/contract/encryption.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/errors.d.ts +50 -0
- package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/migration.d.ts +37 -0
- package/lib/typescript/commonjs/contract/migration.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/query.d.ts +79 -0
- package/lib/typescript/commonjs/contract/query.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/record.d.ts +43 -0
- package/lib/typescript/commonjs/contract/record.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/schema.d.ts +33 -0
- package/lib/typescript/commonjs/contract/schema.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/scope.d.ts +33 -0
- package/lib/typescript/commonjs/contract/scope.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/transaction.d.ts +66 -0
- package/lib/typescript/commonjs/contract/transaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/chunked-cipher.d.ts +57 -0
- package/lib/typescript/commonjs/crypto/chunked-cipher.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/derive.d.ts +28 -0
- package/lib/typescript/commonjs/crypto/derive.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/key-provider.d.ts +30 -0
- package/lib/typescript/commonjs/crypto/key-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/provider.d.ts +35 -0
- package/lib/typescript/commonjs/crypto/provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/dev-log.d.ts +35 -0
- package/lib/typescript/commonjs/diagnostics/dev-log.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts +34 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/faults.d.ts +26 -0
- package/lib/typescript/commonjs/diagnostics/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/map-native.d.ts +31 -0
- package/lib/typescript/commonjs/diagnostics/map-native.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts +70 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +30 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/migration/executor.d.ts +40 -0
- package/lib/typescript/commonjs/migration/executor.d.ts.map +1 -0
- package/lib/typescript/commonjs/migration/ledger.d.ts +34 -0
- package/lib/typescript/commonjs/migration/ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/migration/validate-chain.d.ts +20 -0
- package/lib/typescript/commonjs/migration/validate-chain.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/platform/backup-android-verify.d.ts +30 -0
- package/lib/typescript/commonjs/platform/backup-android-verify.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/backup-ios.d.ts +26 -0
- package/lib/typescript/commonjs/platform/backup-ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/bytes.d.ts +36 -0
- package/lib/typescript/commonjs/platform/bytes.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/fs.d.ts +47 -0
- package/lib/typescript/commonjs/platform/fs.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/location.d.ts +53 -0
- package/lib/typescript/commonjs/platform/location.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/budgets.d.ts +23 -0
- package/lib/typescript/commonjs/query/budgets.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/compare.d.ts +42 -0
- package/lib/typescript/commonjs/query/compare.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/cursor.d.ts +27 -0
- package/lib/typescript/commonjs/query/cursor.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/filter.d.ts +11 -0
- package/lib/typescript/commonjs/query/filter.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/paginate.d.ts +15 -0
- package/lib/typescript/commonjs/query/paginate.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/sort.d.ts +19 -0
- package/lib/typescript/commonjs/query/sort.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/validate.d.ts +15 -0
- package/lib/typescript/commonjs/query/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/schema/declare.d.ts +20 -0
- package/lib/typescript/commonjs/schema/declare.d.ts.map +1 -0
- package/lib/typescript/commonjs/schema/validate-config.d.ts +11 -0
- package/lib/typescript/commonjs/schema/validate-config.d.ts.map +1 -0
- package/lib/typescript/commonjs/scope/hash.d.ts +24 -0
- package/lib/typescript/commonjs/scope/hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/scope/normalize.d.ts +46 -0
- package/lib/typescript/commonjs/scope/normalize.d.ts.map +1 -0
- package/lib/typescript/commonjs/scope/validate.d.ts +15 -0
- package/lib/typescript/commonjs/scope/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/adapter.d.ts +16 -0
- package/lib/typescript/commonjs/sqlite/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/batch.d.ts +25 -0
- package/lib/typescript/commonjs/sqlite/batch.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/catalog.d.ts +34 -0
- package/lib/typescript/commonjs/sqlite/catalog.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/connection.d.ts +58 -0
- package/lib/typescript/commonjs/sqlite/connection.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/index-coverage.d.ts +18 -0
- package/lib/typescript/commonjs/sqlite/index-coverage.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/native.d.ts +48 -0
- package/lib/typescript/commonjs/sqlite/native.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/row-codec.d.ts +69 -0
- package/lib/typescript/commonjs/sqlite/row-codec.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/sql-builder.d.ts +34 -0
- package/lib/typescript/commonjs/sqlite/sql-builder.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/statements.d.ts +26 -0
- package/lib/typescript/commonjs/sqlite/statements.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/transaction-queue.d.ts +31 -0
- package/lib/typescript/commonjs/sqlite/transaction-queue.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/transactions.d.ts +26 -0
- package/lib/typescript/commonjs/sqlite/transactions.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/values.d.ts +13 -0
- package/lib/typescript/commonjs/sqlite/values.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/attachments.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/attachments.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/encryption.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/encryption.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts +58 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/lifecycle.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/lifecycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/migrations.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/migrations.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/queries.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/queries.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/records.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/records.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/scopes.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/scopes.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/transactions.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/transactions.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/faults.d.ts +13 -0
- package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +13 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/attachments.d.ts +23 -0
- package/lib/typescript/commonjs/testing/memory-adapter/attachments.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/collection.d.ts +19 -0
- package/lib/typescript/commonjs/testing/memory-adapter/collection.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/index.d.ts +22 -0
- package/lib/typescript/commonjs/testing/memory-adapter/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/migrations.d.ts +11 -0
- package/lib/typescript/commonjs/testing/memory-adapter/migrations.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/reset.d.ts +23 -0
- package/lib/typescript/commonjs/testing/memory-adapter/reset.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/store.d.ts +54 -0
- package/lib/typescript/commonjs/testing/memory-adapter/store.d.ts.map +1 -0
- package/lib/typescript/module/adapter/budgets.d.ts +19 -0
- package/lib/typescript/module/adapter/budgets.d.ts.map +1 -0
- package/lib/typescript/module/adapter/collection.d.ts +25 -0
- package/lib/typescript/module/adapter/collection.d.ts.map +1 -0
- package/lib/typescript/module/adapter/deletion.d.ts +48 -0
- package/lib/typescript/module/adapter/deletion.d.ts.map +1 -0
- package/lib/typescript/module/adapter/handle.d.ts +30 -0
- package/lib/typescript/module/adapter/handle.d.ts.map +1 -0
- package/lib/typescript/module/adapter/index.d.ts +30 -0
- package/lib/typescript/module/adapter/index.d.ts.map +1 -0
- package/lib/typescript/module/adapter/lifecycle.d.ts +25 -0
- package/lib/typescript/module/adapter/lifecycle.d.ts.map +1 -0
- package/lib/typescript/module/adapter/schema-sync.d.ts +19 -0
- package/lib/typescript/module/adapter/schema-sync.d.ts.map +1 -0
- package/lib/typescript/module/adapter/transaction.d.ts +32 -0
- package/lib/typescript/module/adapter/transaction.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/availability.d.ts +19 -0
- package/lib/typescript/module/artifacts/availability.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/cascade.d.ts +26 -0
- package/lib/typescript/module/artifacts/cascade.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/paths.d.ts +16 -0
- package/lib/typescript/module/artifacts/paths.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/reconcile.d.ts +23 -0
- package/lib/typescript/module/artifacts/reconcile.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/store.d.ts +45 -0
- package/lib/typescript/module/artifacts/store.d.ts.map +1 -0
- package/lib/typescript/module/contract/adapter.d.ts +55 -0
- package/lib/typescript/module/contract/adapter.d.ts.map +1 -0
- package/lib/typescript/module/contract/attachment.d.ts +84 -0
- package/lib/typescript/module/contract/attachment.d.ts.map +1 -0
- package/lib/typescript/module/contract/backup.d.ts +26 -0
- package/lib/typescript/module/contract/backup.d.ts.map +1 -0
- package/lib/typescript/module/contract/config.d.ts +50 -0
- package/lib/typescript/module/contract/config.d.ts.map +1 -0
- package/lib/typescript/module/contract/encryption.d.ts +31 -0
- package/lib/typescript/module/contract/encryption.d.ts.map +1 -0
- package/lib/typescript/module/contract/errors.d.ts +50 -0
- package/lib/typescript/module/contract/errors.d.ts.map +1 -0
- package/lib/typescript/module/contract/migration.d.ts +37 -0
- package/lib/typescript/module/contract/migration.d.ts.map +1 -0
- package/lib/typescript/module/contract/query.d.ts +79 -0
- package/lib/typescript/module/contract/query.d.ts.map +1 -0
- package/lib/typescript/module/contract/record.d.ts +43 -0
- package/lib/typescript/module/contract/record.d.ts.map +1 -0
- package/lib/typescript/module/contract/schema.d.ts +33 -0
- package/lib/typescript/module/contract/schema.d.ts.map +1 -0
- package/lib/typescript/module/contract/scope.d.ts +33 -0
- package/lib/typescript/module/contract/scope.d.ts.map +1 -0
- package/lib/typescript/module/contract/transaction.d.ts +66 -0
- package/lib/typescript/module/contract/transaction.d.ts.map +1 -0
- package/lib/typescript/module/crypto/chunked-cipher.d.ts +57 -0
- package/lib/typescript/module/crypto/chunked-cipher.d.ts.map +1 -0
- package/lib/typescript/module/crypto/derive.d.ts +28 -0
- package/lib/typescript/module/crypto/derive.d.ts.map +1 -0
- package/lib/typescript/module/crypto/key-provider.d.ts +30 -0
- package/lib/typescript/module/crypto/key-provider.d.ts.map +1 -0
- package/lib/typescript/module/crypto/provider.d.ts +35 -0
- package/lib/typescript/module/crypto/provider.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/dev-log.d.ts +35 -0
- package/lib/typescript/module/diagnostics/dev-log.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/errors.d.ts +34 -0
- package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/faults.d.ts +26 -0
- package/lib/typescript/module/diagnostics/faults.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/map-native.d.ts +31 -0
- package/lib/typescript/module/diagnostics/map-native.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/redact.d.ts +70 -0
- package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +30 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/migration/executor.d.ts +40 -0
- package/lib/typescript/module/migration/executor.d.ts.map +1 -0
- package/lib/typescript/module/migration/ledger.d.ts +34 -0
- package/lib/typescript/module/migration/ledger.d.ts.map +1 -0
- package/lib/typescript/module/migration/validate-chain.d.ts +20 -0
- package/lib/typescript/module/migration/validate-chain.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/platform/backup-android-verify.d.ts +30 -0
- package/lib/typescript/module/platform/backup-android-verify.d.ts.map +1 -0
- package/lib/typescript/module/platform/backup-ios.d.ts +26 -0
- package/lib/typescript/module/platform/backup-ios.d.ts.map +1 -0
- package/lib/typescript/module/platform/bytes.d.ts +36 -0
- package/lib/typescript/module/platform/bytes.d.ts.map +1 -0
- package/lib/typescript/module/platform/fs.d.ts +47 -0
- package/lib/typescript/module/platform/fs.d.ts.map +1 -0
- package/lib/typescript/module/platform/location.d.ts +53 -0
- package/lib/typescript/module/platform/location.d.ts.map +1 -0
- package/lib/typescript/module/query/budgets.d.ts +23 -0
- package/lib/typescript/module/query/budgets.d.ts.map +1 -0
- package/lib/typescript/module/query/compare.d.ts +42 -0
- package/lib/typescript/module/query/compare.d.ts.map +1 -0
- package/lib/typescript/module/query/cursor.d.ts +27 -0
- package/lib/typescript/module/query/cursor.d.ts.map +1 -0
- package/lib/typescript/module/query/filter.d.ts +11 -0
- package/lib/typescript/module/query/filter.d.ts.map +1 -0
- package/lib/typescript/module/query/paginate.d.ts +15 -0
- package/lib/typescript/module/query/paginate.d.ts.map +1 -0
- package/lib/typescript/module/query/sort.d.ts +19 -0
- package/lib/typescript/module/query/sort.d.ts.map +1 -0
- package/lib/typescript/module/query/validate.d.ts +15 -0
- package/lib/typescript/module/query/validate.d.ts.map +1 -0
- package/lib/typescript/module/schema/declare.d.ts +20 -0
- package/lib/typescript/module/schema/declare.d.ts.map +1 -0
- package/lib/typescript/module/schema/validate-config.d.ts +11 -0
- package/lib/typescript/module/schema/validate-config.d.ts.map +1 -0
- package/lib/typescript/module/scope/hash.d.ts +24 -0
- package/lib/typescript/module/scope/hash.d.ts.map +1 -0
- package/lib/typescript/module/scope/normalize.d.ts +46 -0
- package/lib/typescript/module/scope/normalize.d.ts.map +1 -0
- package/lib/typescript/module/scope/validate.d.ts +15 -0
- package/lib/typescript/module/scope/validate.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/adapter.d.ts +16 -0
- package/lib/typescript/module/sqlite/adapter.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/batch.d.ts +25 -0
- package/lib/typescript/module/sqlite/batch.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/catalog.d.ts +34 -0
- package/lib/typescript/module/sqlite/catalog.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/connection.d.ts +58 -0
- package/lib/typescript/module/sqlite/connection.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/index-coverage.d.ts +18 -0
- package/lib/typescript/module/sqlite/index-coverage.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/native.d.ts +48 -0
- package/lib/typescript/module/sqlite/native.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/row-codec.d.ts +69 -0
- package/lib/typescript/module/sqlite/row-codec.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/sql-builder.d.ts +34 -0
- package/lib/typescript/module/sqlite/sql-builder.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/statements.d.ts +26 -0
- package/lib/typescript/module/sqlite/statements.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/transaction-queue.d.ts +31 -0
- package/lib/typescript/module/sqlite/transaction-queue.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/transactions.d.ts +26 -0
- package/lib/typescript/module/sqlite/transactions.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/values.d.ts +13 -0
- package/lib/typescript/module/sqlite/values.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/attachments.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/attachments.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/encryption.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/encryption.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/index.d.ts +58 -0
- package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/lifecycle.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/lifecycle.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/migrations.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/migrations.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/queries.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/queries.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/records.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/records.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/scopes.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/scopes.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/transactions.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/transactions.d.ts.map +1 -0
- package/lib/typescript/module/testing/faults.d.ts +13 -0
- package/lib/typescript/module/testing/faults.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +13 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/attachments.d.ts +23 -0
- package/lib/typescript/module/testing/memory-adapter/attachments.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/collection.d.ts +19 -0
- package/lib/typescript/module/testing/memory-adapter/collection.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/index.d.ts +22 -0
- package/lib/typescript/module/testing/memory-adapter/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/migrations.d.ts +11 -0
- package/lib/typescript/module/testing/memory-adapter/migrations.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/reset.d.ts +23 -0
- package/lib/typescript/module/testing/memory-adapter/reset.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/store.d.ts +54 -0
- package/lib/typescript/module/testing/memory-adapter/store.d.ts.map +1 -0
- package/package.json +51 -16
- package/src/crypto/provider.ts +7 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TAG_BYTES = exports.MAGIC = exports.HEADER_BYTES = exports.FORMAT_VERSION = exports.ALGORITHM = void 0;
|
|
7
|
+
exports.chunkCountFor = chunkCountFor;
|
|
8
|
+
exports.chunkOffset = chunkOffset;
|
|
9
|
+
exports.chunkPlaintextLength = chunkPlaintextLength;
|
|
10
|
+
exports.decodeHeader = decodeHeader;
|
|
11
|
+
exports.decryptChunk = decryptChunk;
|
|
12
|
+
exports.encodeHeader = encodeHeader;
|
|
13
|
+
exports.encryptChunk = encryptChunk;
|
|
14
|
+
exports.encryptedLength = encryptedLength;
|
|
15
|
+
exports.headerFor = headerFor;
|
|
16
|
+
var _config = require("../contract/config.js");
|
|
17
|
+
var _errors = require("../contract/errors.js");
|
|
18
|
+
var _errors2 = require("../diagnostics/errors.js");
|
|
19
|
+
var _derive = require("./derive.js");
|
|
20
|
+
var _provider = require("./provider.js");
|
|
21
|
+
var _bytes = require("../platform/bytes.js");
|
|
22
|
+
/**
|
|
23
|
+
* The chunked AES-256-GCM artifact format.
|
|
24
|
+
*
|
|
25
|
+
* Whole-file encryption was rejected because a 100 MB artifact would have to
|
|
26
|
+
* be held in memory twice — plaintext and ciphertext — which breaks FR-107a's
|
|
27
|
+
* flat memory bound and every PERF-001 budget along with it (research.md R4).
|
|
28
|
+
* Chunking keeps exactly one 256 KB chunk in flight regardless of artifact
|
|
29
|
+
* size.
|
|
30
|
+
*
|
|
31
|
+
* ```text
|
|
32
|
+
* [ header 22 bytes ] magic | format version | chunk size | chunk count | plaintext size
|
|
33
|
+
* [ chunk 0 ] ciphertext(≤ chunkSize) | auth tag (16)
|
|
34
|
+
* [ chunk 1 ] …
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* The auth tag follows each chunk rather than sitting in the header, which is
|
|
38
|
+
* a deliberate departure from the sketch in storage-layout.md. A tag is only
|
|
39
|
+
* known after its chunk has been encrypted, and the filesystem peer appends —
|
|
40
|
+
* it cannot seek back to patch a header. Collecting every tag before writing
|
|
41
|
+
* anything would mean buffering the whole ciphertext, which is the thing this
|
|
42
|
+
* format exists to avoid. Inline tags keep the write append-only and leave
|
|
43
|
+
* every chunk at a computable offset.
|
|
44
|
+
*
|
|
45
|
+
* A failing tag on read is `ATTACHMENT_UNDECRYPTABLE`, deliberately distinct
|
|
46
|
+
* from `ATTACHMENT_MISSING` (FR-107c): one is a wrong key or a tampered file
|
|
47
|
+
* and may be recoverable, the other is data that is simply gone.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
const MAGIC = exports.MAGIC = 'LDB1';
|
|
51
|
+
const FORMAT_VERSION = exports.FORMAT_VERSION = 1;
|
|
52
|
+
const HEADER_BYTES = exports.HEADER_BYTES = 22;
|
|
53
|
+
const TAG_BYTES = exports.TAG_BYTES = 16;
|
|
54
|
+
const ALGORITHM = exports.ALGORITHM = 'aes-256-gcm';
|
|
55
|
+
function chunkCountFor(plaintextSize, chunkSize) {
|
|
56
|
+
return plaintextSize === 0 ? 0 : Math.ceil(plaintextSize / chunkSize);
|
|
57
|
+
}
|
|
58
|
+
function encodeHeader(header) {
|
|
59
|
+
const bytes = new Uint8Array(HEADER_BYTES);
|
|
60
|
+
for (let index = 0; index < 4; index += 1) {
|
|
61
|
+
bytes[index] = MAGIC.charCodeAt(index);
|
|
62
|
+
}
|
|
63
|
+
// Big-endian, as DataView writes by default; the on-disk format is unchanged.
|
|
64
|
+
const view = new DataView(bytes.buffer);
|
|
65
|
+
view.setUint16(4, header.formatVersion);
|
|
66
|
+
view.setUint32(6, header.chunkSize);
|
|
67
|
+
view.setUint32(10, header.chunkCount);
|
|
68
|
+
// Split across two 32-bit writes: artifact sizes stay well inside the safe
|
|
69
|
+
// integer range, and this avoids depending on BigInt in Hermes.
|
|
70
|
+
view.setUint32(14, Math.floor(header.plaintextSize / 0x100000000));
|
|
71
|
+
view.setUint32(18, header.plaintextSize % 0x100000000);
|
|
72
|
+
return bytes;
|
|
73
|
+
}
|
|
74
|
+
function decodeHeader(bytes) {
|
|
75
|
+
if (bytes.length < HEADER_BYTES || (0, _bytes.asciiAt)(bytes, 0, 4) !== MAGIC) {
|
|
76
|
+
(0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_UNDECRYPTABLE, {
|
|
77
|
+
message: 'artifact header is not a recognised encrypted artifact'
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, HEADER_BYTES);
|
|
81
|
+
return {
|
|
82
|
+
formatVersion: view.getUint16(4),
|
|
83
|
+
chunkSize: view.getUint32(6),
|
|
84
|
+
chunkCount: view.getUint32(10),
|
|
85
|
+
plaintextSize: view.getUint32(14) * 0x100000000 + view.getUint32(18)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Plaintext length of chunk `index`; the last one is usually short. */
|
|
90
|
+
function chunkPlaintextLength(header, index) {
|
|
91
|
+
const start = index * header.chunkSize;
|
|
92
|
+
return Math.max(0, Math.min(header.chunkSize, header.plaintextSize - start));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Byte offset of chunk `index` in the file.
|
|
97
|
+
*
|
|
98
|
+
* Every chunk but the last is full, so the offset is arithmetic rather than a
|
|
99
|
+
* table lookup — which is what lets a range read seek straight to the chunk
|
|
100
|
+
* it needs instead of walking the file.
|
|
101
|
+
*/
|
|
102
|
+
function chunkOffset(header, index) {
|
|
103
|
+
return HEADER_BYTES + index * (header.chunkSize + TAG_BYTES);
|
|
104
|
+
}
|
|
105
|
+
function encryptedLength(header) {
|
|
106
|
+
if (header.chunkCount === 0) {
|
|
107
|
+
return HEADER_BYTES;
|
|
108
|
+
}
|
|
109
|
+
const lastIndex = header.chunkCount - 1;
|
|
110
|
+
return chunkOffset(header, lastIndex) + chunkPlaintextLength(header, lastIndex) + TAG_BYTES;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** One chunk in, ciphertext with its tag appended out. */
|
|
114
|
+
function encryptChunk(key, index, plaintext) {
|
|
115
|
+
const cipher = (0, _provider.cipherModule)().createCipheriv(ALGORITHM, key, (0, _derive.nonceForChunk)(index));
|
|
116
|
+
return (0, _bytes.concatBytes)([new Uint8Array(cipher.update(plaintext)), new Uint8Array(cipher.final()), new Uint8Array(cipher.getAuthTag())]);
|
|
117
|
+
}
|
|
118
|
+
function decryptChunk(key, index, stored) {
|
|
119
|
+
if (stored.length < TAG_BYTES) {
|
|
120
|
+
(0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_UNDECRYPTABLE, {
|
|
121
|
+
message: 'artifact chunk is truncated'
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const body = stored.subarray(0, stored.length - TAG_BYTES);
|
|
125
|
+
const tag = stored.subarray(stored.length - TAG_BYTES);
|
|
126
|
+
const decipher = (0, _provider.cipherModule)().createDecipheriv(ALGORITHM, key, (0, _derive.nonceForChunk)(index));
|
|
127
|
+
decipher.setAuthTag(tag);
|
|
128
|
+
try {
|
|
129
|
+
return (0, _bytes.concatBytes)([new Uint8Array(decipher.update(body)), new Uint8Array(decipher.final())]);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
// A failing tag is the only signal that separates "exists but will not
|
|
132
|
+
// decrypt" from "missing", and an app responds to them differently.
|
|
133
|
+
(0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_UNDECRYPTABLE, {
|
|
134
|
+
message: 'artifact chunk failed authentication',
|
|
135
|
+
cause: error
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function headerFor(plaintextSize, chunkSize = _config.Budgets.ARTIFACT_CHUNK_BYTES) {
|
|
140
|
+
return {
|
|
141
|
+
formatVersion: FORMAT_VERSION,
|
|
142
|
+
chunkSize,
|
|
143
|
+
chunkCount: chunkCountFor(plaintextSize, chunkSize),
|
|
144
|
+
plaintextSize
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=chunked-cipher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_config","require","_errors","_errors2","_derive","_provider","_bytes","MAGIC","exports","FORMAT_VERSION","HEADER_BYTES","TAG_BYTES","ALGORITHM","chunkCountFor","plaintextSize","chunkSize","Math","ceil","encodeHeader","header","bytes","Uint8Array","index","charCodeAt","view","DataView","buffer","setUint16","formatVersion","setUint32","chunkCount","floor","decodeHeader","length","asciiAt","raise","DiagnosticCodes","ATTACHMENT_UNDECRYPTABLE","message","byteOffset","getUint16","getUint32","chunkPlaintextLength","start","max","min","chunkOffset","encryptedLength","lastIndex","encryptChunk","key","plaintext","cipher","cipherModule","createCipheriv","nonceForChunk","concatBytes","update","final","getAuthTag","decryptChunk","stored","body","subarray","tag","decipher","createDecipheriv","setAuthTag","error","cause","headerFor","Budgets","ARTIFACT_CHUNK_BYTES"],"sourceRoot":"../../../src","sources":["crypto/chunked-cipher.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deriveArtifactKey = deriveArtifactKey;
|
|
7
|
+
exports.nonceForChunk = nonceForChunk;
|
|
8
|
+
var _provider = require("./provider.js");
|
|
9
|
+
var _bytes = require("../platform/bytes.js");
|
|
10
|
+
/**
|
|
11
|
+
* Per-artifact key derivation.
|
|
12
|
+
*
|
|
13
|
+
* The database key is handed straight to SQLCipher. Using that same material
|
|
14
|
+
* as the AES-GCM key for artifacts would mean the two keystreams share a
|
|
15
|
+
* secret, so a weakness in either one — a nonce collision in the artifact
|
|
16
|
+
* format, a padding oracle in the database format — becomes a weakness in
|
|
17
|
+
* both. HKDF costs one hash and removes the coupling entirely (research.md
|
|
18
|
+
* R4).
|
|
19
|
+
*
|
|
20
|
+
* The artifact id is the HKDF `info`, so two artifacts under the same
|
|
21
|
+
* database key derive different subkeys. That is what makes the deterministic
|
|
22
|
+
* nonce scheme safe: a nonce is only ever reused with a different key.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const HKDF_DIGEST = 'sha256';
|
|
26
|
+
const KEY_BYTES = 32;
|
|
27
|
+
const NONCE_BYTES = 12;
|
|
28
|
+
function bytesOf(value) {
|
|
29
|
+
return (0, _bytes.utf8Bytes)(value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 32 bytes, one artifact, one database key. */
|
|
33
|
+
function deriveArtifactKey(databaseKey, scopeKey, attachmentId) {
|
|
34
|
+
const derived = (0, _provider.cipherModule)().hkdfSync(HKDF_DIGEST, bytesOf(databaseKey),
|
|
35
|
+
// The scope digest as salt keeps two scopes holding an artifact under
|
|
36
|
+
// the same id from deriving the same subkey.
|
|
37
|
+
bytesOf(scopeKey), bytesOf(`chipmobilesdk-localdb/artifact/${attachmentId}`), KEY_BYTES);
|
|
38
|
+
return new Uint8Array(derived);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Deterministic 12-byte nonce from the chunk index.
|
|
43
|
+
*
|
|
44
|
+
* Deterministic rather than random because a random nonce would have to be
|
|
45
|
+
* stored per chunk, and because uniqueness is already guaranteed one level
|
|
46
|
+
* up: the key is unique per artifact, so an index that is unique within the
|
|
47
|
+
* artifact is unique under that key. The remaining four bytes are a fixed
|
|
48
|
+
* domain tag rather than padding, so a nonce from this scheme can never
|
|
49
|
+
* collide with one from a future scheme that uses the same counter space.
|
|
50
|
+
*/
|
|
51
|
+
function nonceForChunk(index) {
|
|
52
|
+
const nonce = new Uint8Array(NONCE_BYTES);
|
|
53
|
+
const view = new DataView(nonce.buffer);
|
|
54
|
+
view.setUint32(0, 0x4c444231, false); // "LDB1"
|
|
55
|
+
// Split across two 32-bit writes rather than a BigInt: chunk indexes stay
|
|
56
|
+
// far inside the safe integer range, and Hermes is happier without one.
|
|
57
|
+
view.setUint32(4, Math.floor(index / 0x100000000), false);
|
|
58
|
+
view.setUint32(8, index % 0x100000000, false);
|
|
59
|
+
return nonce;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=derive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_provider","require","_bytes","HKDF_DIGEST","KEY_BYTES","NONCE_BYTES","bytesOf","value","utf8Bytes","deriveArtifactKey","databaseKey","scopeKey","attachmentId","derived","cipherModule","hkdfSync","Uint8Array","nonceForChunk","index","nonce","view","DataView","buffer","setUint32","Math","floor"],"sourceRoot":"../../../src","sources":["crypto/derive.ts"],"mappings":";;;;;;;AAeA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAME,WAAW,GAAG,QAAQ;AAC5B,MAAMC,SAAS,GAAG,EAAE;AACpB,MAAMC,WAAW,GAAG,EAAE;AAEtB,SAASC,OAAOA,CAACC,KAAa,EAAc;EAC3C,OAAO,IAAAC,gBAAS,EAACD,KAAK,CAAC;AACxB;;AAEA;AACO,SAASE,iBAAiBA,CAChCC,WAAmB,EACnBC,QAAgB,EAChBC,YAAoB,EACP;EACb,MAAMC,OAAO,GAAG,IAAAC,sBAAY,EAAC,CAAC,CAACC,QAAQ,CACtCZ,WAAW,EACXG,OAAO,CAACI,WAAW,CAAC;EACpB;EACA;EACAJ,OAAO,CAACK,QAAQ,CAAC,EACjBL,OAAO,CAAC,kCAAkCM,YAAY,EAAE,CAAC,EACzDR,SACD,CAAC;EACD,OAAO,IAAIY,UAAU,CAACH,OAAO,CAAC;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,aAAaA,CAACC,KAAa,EAAc;EACxD,MAAMC,KAAK,GAAG,IAAIH,UAAU,CAACX,WAAW,CAAC;EACzC,MAAMe,IAAI,GAAG,IAAIC,QAAQ,CAACF,KAAK,CAACG,MAAM,CAAC;EACvCF,IAAI,CAACG,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;EACtC;EACA;EACAH,IAAI,CAACG,SAAS,CAAC,CAAC,EAAEC,IAAI,CAACC,KAAK,CAACP,KAAK,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC;EACzDE,IAAI,CAACG,SAAS,CAAC,CAAC,EAAEL,KAAK,GAAG,WAAW,EAAE,KAAK,CAAC;EAC7C,OAAOC,KAAK;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.acquireKey = acquireKey;
|
|
7
|
+
var _errors = require("../contract/errors.js");
|
|
8
|
+
var _errors2 = require("../diagnostics/errors.js");
|
|
9
|
+
var _faults = require("../diagnostics/faults.js");
|
|
10
|
+
/**
|
|
11
|
+
* Key acquisition, scoped to one handle's lifetime.
|
|
12
|
+
*
|
|
13
|
+
* The package never generates, derives from its own material, persists,
|
|
14
|
+
* caches beyond the handle, transmits, or returns a key (FR-098). What it
|
|
15
|
+
* does is ask the app for one at open and hold it exactly as long as the
|
|
16
|
+
* connection that needs it — which is also why no keychain library appears in
|
|
17
|
+
* this package's dependencies (LIB-004).
|
|
18
|
+
*
|
|
19
|
+
* The provider receives the resolved scope, so an app can key per identity.
|
|
20
|
+
* That is not a convenience: it is what makes destroying one identity's key a
|
|
21
|
+
* meaningful answer to a deletion request, rather than a gesture that leaves
|
|
22
|
+
* the data readable under a shared key (FR-104).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A key with an explicit end of life.
|
|
27
|
+
*
|
|
28
|
+
* Handing the string around directly would leave copies wherever it was
|
|
29
|
+
* passed. A handle that can be released gives the connection one place to
|
|
30
|
+
* drop it, and gives `key-hygiene.test.ts` something to assert against.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
async function acquireKey(encryption, scope) {
|
|
34
|
+
let key;
|
|
35
|
+
(0, _faults.throwIfFaulted)('keyProvider');
|
|
36
|
+
try {
|
|
37
|
+
key = await encryption.keyProvider.getKey(scope);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
// A locked device is an expected condition, not a bug (FR-102), which
|
|
40
|
+
// is why this code is retryable and distinct from an invalid key.
|
|
41
|
+
(0, _errors2.raise)(_errors.DiagnosticCodes.KEY_PROVIDER_FAILED, {
|
|
42
|
+
message: 'key provider failed',
|
|
43
|
+
cause: error
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (typeof key !== 'string' || key.length === 0) {
|
|
47
|
+
(0, _errors2.raise)(_errors.DiagnosticCodes.KEY_INVALID, {
|
|
48
|
+
message: 'key provider returned no usable key'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
let released = false;
|
|
52
|
+
return {
|
|
53
|
+
value() {
|
|
54
|
+
if (released || key === null) {
|
|
55
|
+
(0, _errors2.raise)(_errors.DiagnosticCodes.KEY_INVALID, {
|
|
56
|
+
message: 'key material has already been released'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return key;
|
|
60
|
+
},
|
|
61
|
+
release() {
|
|
62
|
+
released = true;
|
|
63
|
+
key = null;
|
|
64
|
+
},
|
|
65
|
+
get released() {
|
|
66
|
+
return released;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=key-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","_errors2","_faults","acquireKey","encryption","scope","key","throwIfFaulted","keyProvider","getKey","error","raise","DiagnosticCodes","KEY_PROVIDER_FAILED","message","cause","length","KEY_INVALID","released","value","release"],"sourceRoot":"../../../src","sources":["crypto/key-provider.ts"],"mappings":";;;;;;AAgBA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,eAAeG,UAAUA,CAC/BC,UAA4B,EAC5BC,KAAoB,EACC;EACrB,IAAIC,GAAkB;EAEtB,IAAAC,sBAAc,EAAC,aAAa,CAAC;EAE7B,IAAI;IACHD,GAAG,GAAG,MAAMF,UAAU,CAACI,WAAW,CAACC,MAAM,CAACJ,KAAK,CAAC;EACjD,CAAC,CAAC,OAAOK,KAAK,EAAE;IACf;IACA;IACA,IAAAC,cAAK,EAACC,uBAAe,CAACC,mBAAmB,EAAE;MAC1CC,OAAO,EAAE,qBAAqB;MAC9BC,KAAK,EAAEL;IACR,CAAC,CAAC;EACH;EAEA,IAAI,OAAOJ,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACU,MAAM,KAAK,CAAC,EAAE;IAChD,IAAAL,cAAK,EAACC,uBAAe,CAACK,WAAW,EAAE;MAClCH,OAAO,EAAE;IACV,CAAC,CAAC;EACH;EAEA,IAAII,QAAQ,GAAG,KAAK;EACpB,OAAO;IACNC,KAAKA,CAAA,EAAW;MACf,IAAID,QAAQ,IAAIZ,GAAG,KAAK,IAAI,EAAE;QAC7B,IAAAK,cAAK,EAACC,uBAAe,CAACK,WAAW,EAAE;UAClCH,OAAO,EAAE;QACV,CAAC,CAAC;MACH;MACA,OAAOR,GAAG;IACX,CAAC;IACDc,OAAOA,CAAA,EAAS;MACfF,QAAQ,GAAG,IAAI;MACfZ,GAAG,GAAG,IAAI;IACX,CAAC;IACD,IAAIY,QAAQA,CAAA,EAAY;MACvB,OAAOA,QAAQ;IAChB;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.cipherModule = cipherModule;
|
|
7
|
+
exports.isCipherAvailable = isCipherAvailable;
|
|
8
|
+
exports.setCipherModule = setCipherModule;
|
|
9
|
+
var _rnCore = require("@chipmobilesdk/rn-core");
|
|
10
|
+
var _errors = require("../contract/errors.js");
|
|
11
|
+
var _errors2 = require("../diagnostics/errors.js");
|
|
12
|
+
/**
|
|
13
|
+
* The cipher peer, behind one lazy accessor.
|
|
14
|
+
*
|
|
15
|
+
* Marked optional in `peerDependenciesMeta`: an app that never enables
|
|
16
|
+
* encryption should not have to install a native crypto module. That makes
|
|
17
|
+
* "the peer is absent" a supported state rather than a broken install, so it
|
|
18
|
+
* reports `ENCRYPTION_UNAVAILABLE` — the same code as a missing SQLCipher
|
|
19
|
+
* build flag, because from the app's side it is the same problem: encryption
|
|
20
|
+
* was asked for and cannot be delivered (research.md R1a).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The two things this package asks of a cipher: AES-256-GCM for artifacts, and
|
|
25
|
+
* HKDF to derive each artifact's subkey. Hashing is not among them — the scope
|
|
26
|
+
* digest is SHA-256 in plain TypeScript (`scope/hash.ts`), because it runs on
|
|
27
|
+
* every scope resolution including the ones that never open an encrypted
|
|
28
|
+
* database, where a native module may not be installed at all (WS4-08).
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** Loaded on first use (rn-core's lazy peer); optional, so absence is a normal answer. */
|
|
32
|
+
const cipher = (0, _rnCore.lazyPeer)('react-native-quick-crypto', () => {
|
|
33
|
+
// Inside `try`, so Metro bundles an app that leaves this optional peer out.
|
|
34
|
+
try {
|
|
35
|
+
return require('react-native-quick-crypto');
|
|
36
|
+
} catch (cause) {
|
|
37
|
+
throw cause;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/** Swap the module. Tests only; `null` goes back to the real one. */
|
|
42
|
+
function setCipherModule(module) {
|
|
43
|
+
cipher.override(module ?? undefined);
|
|
44
|
+
}
|
|
45
|
+
function isCipherAvailable() {
|
|
46
|
+
return cipher.isAvailable();
|
|
47
|
+
}
|
|
48
|
+
function cipherModule() {
|
|
49
|
+
return cipher.require((_peer, cause) => new _errors2.StorageError(_errors.DiagnosticCodes.ENCRYPTION_UNAVAILABLE, {
|
|
50
|
+
message: 'cipher peer is not installed',
|
|
51
|
+
cause
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_rnCore","require","_errors","_errors2","cipher","lazyPeer","cause","setCipherModule","module","override","undefined","isCipherAvailable","isAvailable","cipherModule","_peer","StorageError","DiagnosticCodes","ENCRYPTION_UNAVAILABLE","message"],"sourceRoot":"../../../src","sources":["crypto/provider.ts"],"mappings":";;;;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA;AACA,MAAMG,MAAM,GAAG,IAAAC,gBAAQ,EAAC,2BAA2B,EAAE,MAAM;EAC1D;EACA,IAAI;IACH,OAAOJ,OAAO,CAAC,2BAA2B,CAAC;EAC5C,CAAC,CAAC,OAAOK,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;;AAEF;AACO,SAASC,eAAeA,CAACC,MAA2B,EAAQ;EAClEJ,MAAM,CAACK,QAAQ,CAACD,MAAM,IAAIE,SAAS,CAAC;AACrC;AAEO,SAASC,iBAAiBA,CAAA,EAAY;EAC5C,OAAOP,MAAM,CAACQ,WAAW,CAAC,CAAC;AAC5B;AAEO,SAASC,YAAYA,CAAA,EAAiB;EAC5C,OAAOT,MAAM,CAACH,OAAO,CACpB,CAACa,KAAK,EAAER,KAAK,KACZ,IAAIS,qBAAY,CAACC,uBAAe,CAACC,sBAAsB,EAAE;IACxDC,OAAO,EAAE,8BAA8B;IACvCZ;EACD,CAAC,CACH,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.instrument = instrument;
|
|
7
|
+
exports.isLogging = isLogging;
|
|
8
|
+
exports.logDiagnostic = logDiagnostic;
|
|
9
|
+
exports.setDiagnosticLogger = setDiagnosticLogger;
|
|
10
|
+
var _rnCore = require("@chipmobilesdk/rn-core");
|
|
11
|
+
/**
|
|
12
|
+
* Development-only diagnostics.
|
|
13
|
+
*
|
|
14
|
+
* Operation names, durations, and counts are safe to report. Record payloads,
|
|
15
|
+
* field values, and query parameters are not — in any build, including this
|
|
16
|
+
* one (FR-080, FR-081). There is deliberately no path here that accepts a
|
|
17
|
+
* payload, so a future caller cannot pass one by accident.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
let logger = null;
|
|
21
|
+
|
|
22
|
+
/** Passing null removes the logger. */
|
|
23
|
+
function setDiagnosticLogger(next) {
|
|
24
|
+
logger = next;
|
|
25
|
+
}
|
|
26
|
+
function isDevelopmentBuild() {
|
|
27
|
+
// __DEV__ is a React Native global; the typeof guard keeps this usable
|
|
28
|
+
// under plain Node when the package is exercised from Jest.
|
|
29
|
+
if (typeof __DEV__ !== 'undefined') return __DEV__ === true;
|
|
30
|
+
const {
|
|
31
|
+
process
|
|
32
|
+
} = globalThis;
|
|
33
|
+
return process?.env?.NODE_ENV !== 'production';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A failed operation also reaches the app's SDK sinks (`installSdkSink` from
|
|
38
|
+
* rn-core, CORE-08), in any build: its code, the operation and the collection,
|
|
39
|
+
* which are identifiers this package defines. Successes stay with the
|
|
40
|
+
* development logger.
|
|
41
|
+
*/
|
|
42
|
+
const channel = (0, _rnCore.createDiagnosticChannel)('rn-local-db');
|
|
43
|
+
function logDiagnostic(event) {
|
|
44
|
+
if (event.outcome !== undefined) {
|
|
45
|
+
channel.emit(event.outcome, 'warn', {
|
|
46
|
+
operation: event.operation,
|
|
47
|
+
...(event.collection === undefined ? {} : {
|
|
48
|
+
collection: event.collection
|
|
49
|
+
}),
|
|
50
|
+
...(event.adapter === undefined ? {} : {
|
|
51
|
+
adapter: event.adapter
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!logger || !isDevelopmentBuild()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
logger(event);
|
|
59
|
+
}
|
|
60
|
+
function isLogging() {
|
|
61
|
+
return logger !== null && isDevelopmentBuild();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Wrap a collection so every operation reports its name, duration, and result
|
|
66
|
+
* count — and nothing else.
|
|
67
|
+
*
|
|
68
|
+
* Wrapping once here rather than instrumenting each operation in the adapters
|
|
69
|
+
* is what keeps the guarantee checkable: there is one place that decides what
|
|
70
|
+
* a log line may contain, and it has no access to a payload to leak even if a
|
|
71
|
+
* future change wanted one. The wrapper is applied only when a logger is
|
|
72
|
+
* installed and the build is a development build, so a production bundle pays
|
|
73
|
+
* nothing and emits nothing (FR-081).
|
|
74
|
+
*/
|
|
75
|
+
function instrument(collection, adapter, operations) {
|
|
76
|
+
// Unwrapped unless someone is listening: production pays nothing by default.
|
|
77
|
+
if (!isLogging() && !(0, _rnCore.hasSdkSinks)()) {
|
|
78
|
+
return operations;
|
|
79
|
+
}
|
|
80
|
+
const wrapped = {};
|
|
81
|
+
for (const [name, operation] of Object.entries(operations)) {
|
|
82
|
+
if (typeof operation !== 'function') {
|
|
83
|
+
wrapped[name] = operation;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
wrapped[name] = async (...args) => {
|
|
87
|
+
const started = Date.now();
|
|
88
|
+
try {
|
|
89
|
+
const result = await operation(...args);
|
|
90
|
+
logDiagnostic({
|
|
91
|
+
operation: `${collection}.${name}`,
|
|
92
|
+
durationMs: Date.now() - started,
|
|
93
|
+
collection,
|
|
94
|
+
adapter,
|
|
95
|
+
...(countOf(result) === undefined ? {} : {
|
|
96
|
+
count: countOf(result)
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
return result;
|
|
100
|
+
} catch (error) {
|
|
101
|
+
// The code, never the message: a failure log is exactly where a
|
|
102
|
+
// payload-bearing native message would otherwise end up.
|
|
103
|
+
logDiagnostic({
|
|
104
|
+
operation: `${collection}.${name}`,
|
|
105
|
+
durationMs: Date.now() - started,
|
|
106
|
+
collection,
|
|
107
|
+
adapter,
|
|
108
|
+
outcome: error.code ?? 'failed'
|
|
109
|
+
});
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return wrapped;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** How many records an operation produced, when that is a meaningful answer. */
|
|
118
|
+
function countOf(result) {
|
|
119
|
+
if (typeof result === 'number') {
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
if (result && typeof result === 'object' && Array.isArray(result.records)) {
|
|
123
|
+
return result.records.length;
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=dev-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_rnCore","require","logger","setDiagnosticLogger","next","isDevelopmentBuild","__DEV__","process","globalThis","env","NODE_ENV","channel","createDiagnosticChannel","logDiagnostic","event","outcome","undefined","emit","operation","collection","adapter","isLogging","instrument","operations","hasSdkSinks","wrapped","name","Object","entries","args","started","Date","now","result","durationMs","countOf","count","error","code","Array","isArray","records","length"],"sourceRoot":"../../../src","sources":["diagnostics/dev-log.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DiagnosticCodes", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _errors.DiagnosticCodes;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.StorageError = void 0;
|
|
13
|
+
exports.isCode = isCode;
|
|
14
|
+
exports.isStorageError = isStorageError;
|
|
15
|
+
exports.raise = raise;
|
|
16
|
+
var _rnCore = require("@chipmobilesdk/rn-core");
|
|
17
|
+
var _errors = require("../contract/errors.js");
|
|
18
|
+
var _redact = require("./redact.js");
|
|
19
|
+
/**
|
|
20
|
+
* The single error type the package raises.
|
|
21
|
+
*
|
|
22
|
+
* Everything is redacted on the way in (see redact.ts), so there is no path
|
|
23
|
+
* by which a field value, query parameter, scope component, or key reaches an
|
|
24
|
+
* error object at all.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** The package's error; an `SdkError` (`@chipmobilesdk/rn-core`) with `pkg: 'rn-local-db'`. */
|
|
28
|
+
class StorageError extends _rnCore.SdkError {
|
|
29
|
+
constructor(code, init = {}) {
|
|
30
|
+
// Call sites pass only authored literals (authored-messages.test.ts).
|
|
31
|
+
const message = init.message ? (0, _redact.sanitizeAuthoredMessage)(init.message) : code;
|
|
32
|
+
// `cause` is deliberately NOT kept: the native error it came from may
|
|
33
|
+
// quote the offending value. Only its redacted identifier survives.
|
|
34
|
+
super('rn-local-db', code, {
|
|
35
|
+
message,
|
|
36
|
+
retryable: _errors.RETRYABLE_CODES.has(code),
|
|
37
|
+
redactedCause: (0, _redact.redactCause)(init.cause)
|
|
38
|
+
});
|
|
39
|
+
this.name = 'StorageError';
|
|
40
|
+
this.detail = (0, _redact.redactDetail)(init.detail);
|
|
41
|
+
// Version numbers and an outcome enum — no payload can hide in these.
|
|
42
|
+
this.migration = init.migration;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.StorageError = StorageError;
|
|
46
|
+
function isStorageError(value) {
|
|
47
|
+
return value instanceof StorageError;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** So no consumer ever has to parse a message string (FR-082). */
|
|
51
|
+
function isCode(value, code) {
|
|
52
|
+
return isStorageError(value) && value.code === code;
|
|
53
|
+
}
|
|
54
|
+
function raise(code, init) {
|
|
55
|
+
throw new StorageError(code, init);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_rnCore","require","_errors","_redact","StorageError","SdkError","constructor","code","init","message","sanitizeAuthoredMessage","retryable","RETRYABLE_CODES","has","redactedCause","redactCause","cause","name","detail","redactDetail","migration","exports","isStorageError","value","isCode","raise"],"sourceRoot":"../../../src","sources":["diagnostics/errors.ts"],"mappings":";;;;;;;;;;;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACO,MAAMG,YAAY,SAASC,gBAAQ,CAAiB;EAI1DC,WAAWA,CAACC,IAAoB,EAAEC,IAAsB,GAAG,CAAC,CAAC,EAAE;IAC9D;IACA,MAAMC,OAAO,GAAGD,IAAI,CAACC,OAAO,GAAG,IAAAC,+BAAuB,EAACF,IAAI,CAACC,OAAO,CAAC,GAAGF,IAAI;IAC3E;IACA;IACA,KAAK,CAAC,aAAa,EAAEA,IAAI,EAAE;MAC1BE,OAAO;MACPE,SAAS,EAAEC,uBAAe,CAACC,GAAG,CAACN,IAAI,CAAC;MACpCO,aAAa,EAAE,IAAAC,mBAAW,EAACP,IAAI,CAACQ,KAAK;IACtC,CAAC,CAAC;IACF,IAAI,CAACC,IAAI,GAAG,cAAc;IAC1B,IAAI,CAACC,MAAM,GAAG,IAAAC,oBAAY,EAACX,IAAI,CAACU,MAAM,CAAC;IACvC;IACA,IAAI,CAACE,SAAS,GAAGZ,IAAI,CAACY,SAAS;EAChC;AACD;AAACC,OAAA,CAAAjB,YAAA,GAAAA,YAAA;AAEM,SAASkB,cAAcA,CAACC,KAAc,EAAyB;EACrE,OAAOA,KAAK,YAAYnB,YAAY;AACrC;;AAEA;AACO,SAASoB,MAAMA,CAACD,KAAc,EAAEhB,IAAoB,EAAW;EACrE,OAAOe,cAAc,CAACC,KAAK,CAAC,IAAIA,KAAK,CAAChB,IAAI,KAAKA,IAAI;AACpD;AAEO,SAASkB,KAAKA,CAAClB,IAAoB,EAAEC,IAAuB,EAAS;EAC3E,MAAM,IAAIJ,YAAY,CAACG,IAAI,EAAEC,IAAI,CAAC;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.activeFaults = activeFaults;
|
|
7
|
+
exports.clearFaults = clearFaults;
|
|
8
|
+
exports.injectFault = injectFault;
|
|
9
|
+
exports.throwIfFaulted = throwIfFaulted;
|
|
10
|
+
var _errors = require("./errors.js");
|
|
11
|
+
/**
|
|
12
|
+
* The fault registry.
|
|
13
|
+
*
|
|
14
|
+
* It lives here rather than under `testing/` because FR-095 wants every
|
|
15
|
+
* documented failure reachable from a real app running the real adapter — the
|
|
16
|
+
* demo's fault-injection panel exercises the on-device path, not a simulation
|
|
17
|
+
* of it. So the check has to exist in production code.
|
|
18
|
+
*
|
|
19
|
+
* What does *not* exist in production code is a way to inject: `injectFault`
|
|
20
|
+
* and `clearFaults` are exported only from the `./testing` entrypoint. With
|
|
21
|
+
* nothing injected this is one lookup in an empty map, which is the price of
|
|
22
|
+
* being able to prove a recovery path works before a user finds it broken.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const faults = new Map();
|
|
26
|
+
function injectFault(spec) {
|
|
27
|
+
faults.set(spec.at, {
|
|
28
|
+
code: spec.code,
|
|
29
|
+
remaining: spec.times ?? Number.POSITIVE_INFINITY
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function clearFaults() {
|
|
33
|
+
faults.clear();
|
|
34
|
+
}
|
|
35
|
+
function activeFaults() {
|
|
36
|
+
return [...faults.keys()];
|
|
37
|
+
}
|
|
38
|
+
function throwIfFaulted(point) {
|
|
39
|
+
if (faults.size === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const fault = faults.get(point);
|
|
43
|
+
if (!fault || fault.remaining <= 0) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
fault.remaining -= 1;
|
|
47
|
+
if (fault.remaining <= 0) {
|
|
48
|
+
faults.delete(point);
|
|
49
|
+
}
|
|
50
|
+
throw new _errors.StorageError(fault.code, {
|
|
51
|
+
message: `injected fault at ${point}`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=faults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","faults","Map","injectFault","spec","set","at","code","remaining","times","Number","POSITIVE_INFINITY","clearFaults","clear","activeFaults","keys","throwIfFaulted","point","size","fault","get","delete","StorageError","message"],"sourceRoot":"../../../src","sources":["diagnostics/faults.ts"],"mappings":";;;;;;;;;AAeA,IAAAA,OAAA,GAAAC,OAAA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAA0D,CAAC;AAE1E,SAASC,WAAWA,CAACC,IAAe,EAAQ;EAClDH,MAAM,CAACI,GAAG,CAACD,IAAI,CAACE,EAAE,EAAE;IACnBC,IAAI,EAAEH,IAAI,CAACG,IAAI;IACfC,SAAS,EAAEJ,IAAI,CAACK,KAAK,IAAIC,MAAM,CAACC;EACjC,CAAC,CAAC;AACH;AAEO,SAASC,WAAWA,CAAA,EAAS;EACnCX,MAAM,CAACY,KAAK,CAAC,CAAC;AACf;AAEO,SAASC,YAAYA,CAAA,EAAiB;EAC5C,OAAO,CAAC,GAAGb,MAAM,CAACc,IAAI,CAAC,CAAC,CAAC;AAC1B;AAEO,SAASC,cAAcA,CAACC,KAAiB,EAAQ;EACvD,IAAIhB,MAAM,CAACiB,IAAI,KAAK,CAAC,EAAE;IACtB;EACD;EACA,MAAMC,KAAK,GAAGlB,MAAM,CAACmB,GAAG,CAACH,KAAK,CAAC;EAC/B,IAAI,CAACE,KAAK,IAAIA,KAAK,CAACX,SAAS,IAAI,CAAC,EAAE;IACnC;EACD;EACAW,KAAK,CAACX,SAAS,IAAI,CAAC;EACpB,IAAIW,KAAK,CAACX,SAAS,IAAI,CAAC,EAAE;IACzBP,MAAM,CAACoB,MAAM,CAACJ,KAAK,CAAC;EACrB;EACA,MAAM,IAAIK,oBAAY,CAACH,KAAK,CAACZ,IAAI,EAAE;IAAEgB,OAAO,EAAE,qBAAqBN,KAAK;EAAG,CAAC,CAAC;AAC9E","ignoreList":[]}
|