@massalabs/gossip-sdk 0.1.1-dev.20260903185520 → 0.2.1-dev.20260903192154
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 +43 -0
- package/README.md +31 -0
- package/THIRD_PARTY_NOTICES.txt +7 -45
- package/dist/api/restClient.js +5 -3
- package/dist/assets/generated/wasm/gossip_wasm.d.ts +8 -8
- package/dist/assets/generated/wasm/gossip_wasm.js +26 -27
- package/dist/assets/generated/wasm/gossip_wasm_bg.wasm +0 -0
- package/dist/assets/generated/wasm-secureStorage/secureStorage.d.ts +115 -21
- package/dist/assets/generated/wasm-secureStorage/secureStorage.js +381 -119
- package/dist/assets/generated/wasm-secureStorage/secureStorage_bg.wasm +0 -0
- package/dist/assets/generated/wasm-secureStorage/secureStorage_bg.wasm.d.ts +25 -5
- package/dist/db/db.d.ts +23 -13
- package/dist/db/db.js +6 -0
- package/dist/db/generated-migrations.d.ts +1 -0
- package/dist/db/generated-migrations.js +24 -0
- package/dist/db/migrate.d.ts +1 -0
- package/dist/db/migrate.js +61 -4
- package/dist/db/queries/accountSettings.d.ts +16 -0
- package/dist/db/queries/accountSettings.js +87 -0
- package/dist/db/queries/index.d.ts +8 -0
- package/dist/db/queries/index.js +24 -0
- package/dist/db/queries/messagingSessionRecovery.d.ts +11 -0
- package/dist/db/queries/messagingSessionRecovery.js +38 -0
- package/dist/db/queries/privateMigration.d.ts +14 -0
- package/dist/db/queries/privateMigration.js +113 -0
- package/dist/db/queries/userProfile.d.ts +3 -2
- package/dist/db/queries/userProfile.js +184 -37
- package/dist/db/schema/accountSettings.d.ts +79 -0
- package/dist/db/schema/accountSettings.js +13 -0
- package/dist/db/schema/index.d.ts +2 -0
- package/dist/db/schema/index.js +2 -0
- package/dist/db/schema/privateMigration.d.ts +85 -0
- package/dist/db/schema/privateMigration.js +17 -0
- package/dist/db/secure-storage-errors.d.ts +6 -0
- package/dist/db/secure-storage-errors.js +20 -0
- package/dist/db/secure-storage-native.d.ts +41 -0
- package/dist/db/secure-storage-native.js +116 -0
- package/dist/db/secure-storage-portable-web.d.ts +97 -0
- package/dist/db/secure-storage-portable-web.js +1638 -0
- package/dist/db/secure-storage-worker-api.d.ts +222 -0
- package/dist/db/secure-storage-worker-api.js +1166 -0
- package/dist/db/secure-storage-worker.d.ts +1 -151
- package/dist/db/secure-storage-worker.js +1 -318
- package/dist/db/sql-statement.d.ts +4 -0
- package/dist/db/sql-statement.js +90 -0
- package/dist/db/sqlite.d.ts +28 -14
- package/dist/db/sqlite.js +469 -47
- package/dist/gossip.d.ts +107 -7
- package/dist/gossip.js +910 -154
- package/dist/services/auth.d.ts +7 -0
- package/dist/services/auth.js +82 -9
- package/dist/services/discussion.d.ts +4 -1
- package/dist/services/discussion.js +9 -4
- package/dist/services/profile.d.ts +2 -1
- package/dist/services/profile.js +10 -1
- package/dist/wasm/session.d.ts +2 -0
- package/dist/wasm/session.js +35 -7
- package/package.json +5 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
|
|
7
|
+
- `Queries.userProfiles.updateById(userId, data)` now returns
|
|
8
|
+
`Promise<boolean>` instead of `Promise<void>`. It resolves to `true` when a
|
|
9
|
+
profile row matched the user ID and `false` when no row existed. Callers that
|
|
10
|
+
only await the operation can continue ignoring the result; typed wrappers and
|
|
11
|
+
test doubles must adopt the boolean return contract.
|
|
12
|
+
- `GossipSdk.publicKeys` is a borrowed session-owned WASM wrapper. It is valid
|
|
13
|
+
only while that session is open, becomes invalid when `closeSession()` or
|
|
14
|
+
`destroy()` disposes the session, and must not be freed by callers. Code that
|
|
15
|
+
needs serialized key bytes after logout must copy them before closing.
|
|
16
|
+
- Legacy biometric-only credentials and pre-password classic or secure-storage
|
|
17
|
+
account state are intentionally not migrated by this release. Users upgrading
|
|
18
|
+
from those formats must reset local app storage and create their accounts
|
|
19
|
+
again; legacy import is not supported.
|
|
20
|
+
- Secure-storage onboarding now requires the atomic candidate lifecycle exposed
|
|
21
|
+
by `secureStorageBeginOnboardingCandidate()`,
|
|
22
|
+
`secureStorageCommitOnboardingCandidate()`, and
|
|
23
|
+
`secureStorageAbortOnboardingCandidate()`. Every created account must be
|
|
24
|
+
locked before one final commit or abort, and commit/abort reject with
|
|
25
|
+
`SESSION_OPEN` while an SDK session remains open. Fresh stores also require
|
|
26
|
+
versioned backend account-generation metadata.
|
|
27
|
+
|
|
28
|
+
### Security and reliability
|
|
29
|
+
|
|
30
|
+
- Account passwords are mandatory and biometric login stores one password-only
|
|
31
|
+
credential without account metadata.
|
|
32
|
+
- Onboarding and portable import commit the same source-neutral generation
|
|
33
|
+
record with a fresh random epoch for idempotent encrypted-account migration.
|
|
34
|
+
- Onboarding prepares all accounts and fresh cover slots in a bounded in-memory
|
|
35
|
+
candidate, then installs the complete three-slot generation atomically.
|
|
36
|
+
Process death before activation exposes no account; death after activation
|
|
37
|
+
preserves the whole batch.
|
|
38
|
+
- Onboarding rollback and transient/session key disposal preserve cleanup and
|
|
39
|
+
ownership boundaries.
|
|
40
|
+
- Secure-storage allocation, cover traffic, namespace writes, SQL transactions,
|
|
41
|
+
lock, flush, and close share durable recovery and FIFO ordering boundaries.
|
|
42
|
+
- Public-key publication preserves confirmed POST times across local persistence
|
|
43
|
+
retries without redundant network publication.
|
package/README.md
CHANGED
|
@@ -121,6 +121,37 @@ await sdk.openSession({
|
|
|
121
121
|
await sdk.closeSession();
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
### Atomic secure-storage onboarding
|
|
125
|
+
|
|
126
|
+
A fresh secure-storage backend accepts account creation only inside one atomic
|
|
127
|
+
candidate. Begin once, create and durably lock every account, then commit the
|
|
128
|
+
complete generation or abort it:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
await sdk.secureStorageBeginOnboardingCandidate();
|
|
132
|
+
try {
|
|
133
|
+
for (const account of accounts) {
|
|
134
|
+
await sdk.secureStorageCreate(account.slot, account.password);
|
|
135
|
+
// Write this account's encrypted profile/session data here.
|
|
136
|
+
await sdk.secureStorageLock();
|
|
137
|
+
}
|
|
138
|
+
await sdk.secureStorageCommitOnboardingCandidate();
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (sdk.isSessionOpen) await sdk.closeSession();
|
|
141
|
+
if (sdk.storageState === 'unlocked') await sdk.secureStorageLock();
|
|
142
|
+
await sdk.secureStorageAbortOnboardingCandidate().catch(() => {});
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`secureStorageCommitOnboardingCandidate()` and
|
|
148
|
+
`secureStorageAbortOnboardingCandidate()` reject with `SESSION_OPEN` while an
|
|
149
|
+
SDK session is open. Process termination before commit discards the in-memory
|
|
150
|
+
candidate; one successful commit activates all three slots together. Both
|
|
151
|
+
onboarding and portable import expose the same source-neutral
|
|
152
|
+
`accountGenerationEpoch`, which encrypted per-account migrations can use as an
|
|
153
|
+
idempotency key.
|
|
154
|
+
|
|
124
155
|
## Service APIs
|
|
125
156
|
|
|
126
157
|
All services are available after `openSession()` is called.
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -900,9 +900,9 @@ License: MIT OR Apache-2.0
|
|
|
900
900
|
Source: registry+https://github.com/rust-lang/crates.io-index
|
|
901
901
|
License text references: 0218327e7a480793, 4cada0bd02ea3692
|
|
902
902
|
|
|
903
|
-
Cargo: pq-rerand@0.
|
|
903
|
+
Cargo: pq-rerand@0.2.0
|
|
904
904
|
License: NOASSERTION (UNRESOLVED)
|
|
905
|
-
Source: git+https://github.com/massalabs/pq-rerand?rev=
|
|
905
|
+
Source: git+https://github.com/massalabs/pq-rerand?rev=9a5a48beb0af01b0f23e5b68e2c6b53e38e7eb2a#9a5a48beb0af01b0f23e5b68e2c6b53e38e7eb2a
|
|
906
906
|
License text references: none found
|
|
907
907
|
Review note: No license declaration or license file was found at the pinned revision.
|
|
908
908
|
|
|
@@ -986,11 +986,6 @@ License: MIT OR Apache-2.0
|
|
|
986
986
|
Source: registry+https://github.com/rust-lang/crates.io-index
|
|
987
987
|
License text references: 90eb64f0279b0d94, 6df43f6f4b5d4587, 209fbbe0ad52d923
|
|
988
988
|
|
|
989
|
-
Cargo: rand_distr@0.4.3
|
|
990
|
-
License: MIT OR Apache-2.0
|
|
991
|
-
Source: registry+https://github.com/rust-lang/crates.io-index
|
|
992
|
-
License text references: 90eb64f0279b0d94, 6df43f6f4b5d4587, a771e4354f6b3ad4
|
|
993
|
-
|
|
994
989
|
Cargo: rand_xorshift@0.4.0
|
|
995
990
|
License: MIT OR Apache-2.0
|
|
996
991
|
Source: registry+https://github.com/rust-lang/crates.io-index
|
|
@@ -1001,7 +996,7 @@ License: MIT OR Apache-2.0
|
|
|
1001
996
|
Source: registry+https://github.com/rust-lang/crates.io-index
|
|
1002
997
|
License text references: d902d7d4433c0809, d7bb236e93b1117d
|
|
1003
998
|
|
|
1004
|
-
Cargo: rayon@1.
|
|
999
|
+
Cargo: rayon@1.12.0
|
|
1005
1000
|
License: MIT OR Apache-2.0
|
|
1006
1001
|
Source: registry+https://github.com/rust-lang/crates.io-index
|
|
1007
1002
|
License text references: a60eea8175145316, 0621878e61f0d0fd
|
|
@@ -2201,7 +2196,7 @@ SOFTWARE.
|
|
|
2201
2196
|
Text reference: 0621878e61f0d0fd
|
|
2202
2197
|
SHA-256: 0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720
|
|
2203
2198
|
File names: LICENSE-MIT
|
|
2204
|
-
Used by: Cargo:rayon-core@1.13.0, Cargo:rayon@1.
|
|
2199
|
+
Used by: Cargo:rayon-core@1.13.0, Cargo:rayon@1.12.0
|
|
2205
2200
|
|
|
2206
2201
|
Copyright (c) 2010 The Rust Project Developers
|
|
2207
2202
|
|
|
@@ -6363,7 +6358,7 @@ the BSD 1-Clause License <LICENSE-BSD-1> or
|
|
|
6363
6358
|
Text reference: 6df43f6f4b5d4587
|
|
6364
6359
|
SHA-256: 6df43f6f4b5d4587f3d8d71e45532c688fd168afa5fe89d571cb32fa09c4ef51
|
|
6365
6360
|
File names: LICENSE-APACHE
|
|
6366
|
-
Used by: Cargo:rand_core@0.6.4, Cargo:rand_core@0.9.3
|
|
6361
|
+
Used by: Cargo:rand_core@0.6.4, Cargo:rand_core@0.9.3
|
|
6367
6362
|
|
|
6368
6363
|
Apache License
|
|
6369
6364
|
Version 2.0, January 2004
|
|
@@ -8724,7 +8719,7 @@ SOFTWARE.
|
|
|
8724
8719
|
Text reference: 90eb64f0279b0d94
|
|
8725
8720
|
SHA-256: 90eb64f0279b0d9432accfa6023ff803bc4965212383697eee27a0f426d5f8d5
|
|
8726
8721
|
File names: COPYRIGHT
|
|
8727
|
-
Used by: Cargo:rand@0.8.5, Cargo:rand@0.9.2, Cargo:rand_chacha@0.3.1, Cargo:rand_chacha@0.9.0, Cargo:rand_core@0.6.4, Cargo:rand_core@0.9.3, Cargo:
|
|
8722
|
+
Used by: Cargo:rand@0.8.5, Cargo:rand@0.9.2, Cargo:rand_chacha@0.3.1, Cargo:rand_chacha@0.9.0, Cargo:rand_core@0.6.4, Cargo:rand_core@0.9.3, Cargo:rand_xorshift@0.4.0
|
|
8728
8723
|
|
|
8729
8724
|
Copyrights in the Rand project are retained by their contributors. No
|
|
8730
8725
|
copyright assignment is required to contribute to the Rand project.
|
|
@@ -9346,7 +9341,7 @@ SOFTWARE.
|
|
|
9346
9341
|
Text reference: a60eea8175145316
|
|
9347
9342
|
SHA-256: a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2
|
|
9348
9343
|
File names: LICENSE-APACHE
|
|
9349
|
-
Used by: Cargo:ark-ff-asm@0.3.0, Cargo:ark-ff-macros@0.3.0, Cargo:ark-ff@0.3.0, Cargo:ark-serialize@0.3.0, Cargo:ark-std@0.3.0, Cargo:ark-std@0.4.0, Cargo:ark-std@0.5.0, Cargo:arrayvec@0.7.6, Cargo:autocfg@1.5.0, Cargo:bitflags@2.11.0, Cargo:bs58@0.5.1, Cargo:bumpalo@3.19.0, Cargo:camino@1.2.2, Cargo:cc@1.2.39, Cargo:cfg-if@1.0.3, Cargo:crossbeam-deque@0.8.6, Cargo:crossbeam-epoch@0.9.18, Cargo:crossbeam-utils@0.8.21, Cargo:curve25519-dalek-derive@0.1.1, Cargo:derivative@2.2.0, Cargo:displaydoc@0.2.5, Cargo:either@1.15.0, Cargo:equivalent@1.0.2, Cargo:errno@0.3.14, Cargo:fastrand@2.4.1, Cargo:ff@0.13.1, Cargo:find-msvc-tools@0.1.2, Cargo:fnv@1.0.7, Cargo:fs-err@2.11.0, Cargo:glob@0.3.3, Cargo:group@0.13.0, Cargo:hashbrown@0.16.1, Cargo:heck@0.5.0, Cargo:indexmap@2.13.1, Cargo:itertools@0.10.5, Cargo:itertools@0.13.0, Cargo:js-sys@0.3.81, Cargo:linux-raw-sys@0.11.0, Cargo:log@0.4.28, Cargo:num-bigint@0.4.6, Cargo:num-complex@0.4.6, Cargo:num-integer@0.1.46, Cargo:num-iter@0.1.45, Cargo:num-rational@0.4.2, Cargo:num-traits@0.2.19, Cargo:num@0.4.3, Cargo:once_cell@1.21.3, Cargo:percent-encoding@2.3.2, Cargo:pest@2.8.6, Cargo:plain@0.2.3, Cargo:proptest@1.11.0, Cargo:rayon-core@1.13.0, Cargo:rayon@1.
|
|
9344
|
+
Used by: Cargo:ark-ff-asm@0.3.0, Cargo:ark-ff-macros@0.3.0, Cargo:ark-ff@0.3.0, Cargo:ark-serialize@0.3.0, Cargo:ark-std@0.3.0, Cargo:ark-std@0.4.0, Cargo:ark-std@0.5.0, Cargo:arrayvec@0.7.6, Cargo:autocfg@1.5.0, Cargo:bitflags@2.11.0, Cargo:bs58@0.5.1, Cargo:bumpalo@3.19.0, Cargo:camino@1.2.2, Cargo:cc@1.2.39, Cargo:cfg-if@1.0.3, Cargo:crossbeam-deque@0.8.6, Cargo:crossbeam-epoch@0.9.18, Cargo:crossbeam-utils@0.8.21, Cargo:curve25519-dalek-derive@0.1.1, Cargo:derivative@2.2.0, Cargo:displaydoc@0.2.5, Cargo:either@1.15.0, Cargo:equivalent@1.0.2, Cargo:errno@0.3.14, Cargo:fastrand@2.4.1, Cargo:ff@0.13.1, Cargo:find-msvc-tools@0.1.2, Cargo:fnv@1.0.7, Cargo:fs-err@2.11.0, Cargo:glob@0.3.3, Cargo:group@0.13.0, Cargo:hashbrown@0.16.1, Cargo:heck@0.5.0, Cargo:indexmap@2.13.1, Cargo:itertools@0.10.5, Cargo:itertools@0.13.0, Cargo:js-sys@0.3.81, Cargo:linux-raw-sys@0.11.0, Cargo:log@0.4.28, Cargo:num-bigint@0.4.6, Cargo:num-complex@0.4.6, Cargo:num-integer@0.1.46, Cargo:num-iter@0.1.45, Cargo:num-rational@0.4.2, Cargo:num-traits@0.2.19, Cargo:num@0.4.3, Cargo:once_cell@1.21.3, Cargo:percent-encoding@2.3.2, Cargo:pest@2.8.6, Cargo:plain@0.2.3, Cargo:proptest@1.11.0, Cargo:rayon-core@1.13.0, Cargo:rayon@1.12.0, Cargo:regex-syntax@0.8.10, Cargo:rustc-hex@2.1.0, Cargo:rustc_version@0.3.3, Cargo:rustc_version@0.4.1, Cargo:rustix@1.1.2, Cargo:rusty-fork@0.3.1, Cargo:semver-parser@0.10.3, Cargo:semver@0.11.0, Cargo:syn@1.0.109, Cargo:tempfile@3.23.0, Cargo:ucd-trie@0.1.7, Cargo:unicode-segmentation@1.13.2, Cargo:unicode-xid@0.2.6, Cargo:uuid@1.18.1, Cargo:version_check@0.9.5, Cargo:wait-timeout@0.2.1, Cargo:wasi@0.11.1+wasi-snapshot-preview1, Cargo:wasi@0.14.7+wasi-0.2.4, Cargo:wasm-bindgen-backend@0.2.104, Cargo:wasm-bindgen-macro-support@0.2.104, Cargo:wasm-bindgen-macro@0.2.104, Cargo:wasm-bindgen-shared@0.2.104, Cargo:wasm-bindgen@0.2.104, Cargo:web-sys@0.3.81, Cargo:wit-bindgen@0.46.0
|
|
9350
9345
|
|
|
9351
9346
|
Apache License
|
|
9352
9347
|
Version 2.0, January 2004
|
|
@@ -9963,39 +9958,6 @@ Used by: npm:google-protobuf@3.21.4
|
|
|
9963
9958
|
|
|
9964
9959
|
------------------------------------------------------------------------------
|
|
9965
9960
|
|
|
9966
|
-
Text reference: a771e4354f6b3ad4
|
|
9967
|
-
SHA-256: a771e4354f6b3ad4c92da1a5c9a239b6c291527db869632ecea4f20e24ca1135
|
|
9968
|
-
File names: LICENSE-MIT
|
|
9969
|
-
Used by: Cargo:rand_distr@0.4.3
|
|
9970
|
-
|
|
9971
|
-
Copyright 2018 Developers of the Rand project
|
|
9972
|
-
|
|
9973
|
-
Permission is hereby granted, free of charge, to any
|
|
9974
|
-
person obtaining a copy of this software and associated
|
|
9975
|
-
documentation files (the "Software"), to deal in the
|
|
9976
|
-
Software without restriction, including without
|
|
9977
|
-
limitation the rights to use, copy, modify, merge,
|
|
9978
|
-
publish, distribute, sublicense, and/or sell copies of
|
|
9979
|
-
the Software, and to permit persons to whom the Software
|
|
9980
|
-
is furnished to do so, subject to the following
|
|
9981
|
-
conditions:
|
|
9982
|
-
|
|
9983
|
-
The above copyright notice and this permission notice
|
|
9984
|
-
shall be included in all copies or substantial portions
|
|
9985
|
-
of the Software.
|
|
9986
|
-
|
|
9987
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
9988
|
-
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
9989
|
-
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
9990
|
-
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
9991
|
-
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
9992
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
9993
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
9994
|
-
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
9995
|
-
DEALINGS IN THE SOFTWARE.
|
|
9996
|
-
|
|
9997
|
-
------------------------------------------------------------------------------
|
|
9998
|
-
|
|
9999
9961
|
Text reference: a825bd853ab71619
|
|
10000
9962
|
SHA-256: a825bd853ab71619a4923d7b4311221427848070ff44d990da39b0b274c1683f
|
|
10001
9963
|
File names: LICENSE-MIT
|
package/dist/api/restClient.js
CHANGED
|
@@ -23,14 +23,13 @@ export class RestClient {
|
|
|
23
23
|
async makeRequest(url, options) {
|
|
24
24
|
let lastError = null;
|
|
25
25
|
for (let attempt = 1; attempt <= this.retryAttempts; attempt++) {
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
26
28
|
try {
|
|
27
|
-
const controller = new AbortController();
|
|
28
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
29
29
|
const response = await fetch(url, {
|
|
30
30
|
...options,
|
|
31
31
|
signal: controller.signal,
|
|
32
32
|
});
|
|
33
|
-
clearTimeout(timeoutId);
|
|
34
33
|
if (!response.ok) {
|
|
35
34
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
36
35
|
}
|
|
@@ -45,6 +44,9 @@ export class RestClient {
|
|
|
45
44
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
46
45
|
}
|
|
47
46
|
}
|
|
47
|
+
finally {
|
|
48
|
+
clearTimeout(timeoutId);
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
51
|
return {
|
|
50
52
|
success: false,
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function start(): void;
|
|
4
|
+
/**
|
|
5
|
+
* Generates user keys from a passphrase.
|
|
6
|
+
*
|
|
7
|
+
* Derives all gossip keys (DSA, KEM, Massa, EVM) in a single WASM call so
|
|
8
|
+
* the passphrase crosses the JS boundary only once.
|
|
9
|
+
*/
|
|
10
|
+
export function generate_user_keys(passphrase: string): UserKeys;
|
|
3
11
|
/**
|
|
4
12
|
* Encrypts data using AES-256-SIV authenticated encryption.
|
|
5
13
|
*
|
|
@@ -33,14 +41,6 @@
|
|
|
33
41
|
* ```
|
|
34
42
|
*/
|
|
35
43
|
export function aead_encrypt(key: EncryptionKey, nonce: Nonce, plaintext: Uint8Array, aad: Uint8Array): Uint8Array;
|
|
36
|
-
/**
|
|
37
|
-
* Generates user keys from a passphrase.
|
|
38
|
-
*
|
|
39
|
-
* Derives all gossip keys (DSA, KEM, Massa, EVM) in a single WASM call so
|
|
40
|
-
* the passphrase crosses the JS boundary only once.
|
|
41
|
-
*/
|
|
42
|
-
export function generate_user_keys(passphrase: string): UserKeys;
|
|
43
|
-
export function start(): void;
|
|
44
44
|
/**
|
|
45
45
|
* Decrypts data using AES-256-SIV authenticated encryption.
|
|
46
46
|
*
|
|
@@ -117,11 +117,8 @@ function isLikeNone(x) {
|
|
|
117
117
|
return x === undefined || x === null;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
123
|
-
WASM_VECTOR_LEN = arg.length;
|
|
124
|
-
return ptr;
|
|
120
|
+
export function start() {
|
|
121
|
+
wasm.start();
|
|
125
122
|
}
|
|
126
123
|
|
|
127
124
|
function takeFromExternrefTable0(idx) {
|
|
@@ -129,12 +126,36 @@ function takeFromExternrefTable0(idx) {
|
|
|
129
126
|
wasm.__externref_table_dealloc(idx);
|
|
130
127
|
return value;
|
|
131
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Generates user keys from a passphrase.
|
|
131
|
+
*
|
|
132
|
+
* Derives all gossip keys (DSA, KEM, Massa, EVM) in a single WASM call so
|
|
133
|
+
* the passphrase crosses the JS boundary only once.
|
|
134
|
+
* @param {string} passphrase
|
|
135
|
+
* @returns {UserKeys}
|
|
136
|
+
*/
|
|
137
|
+
export function generate_user_keys(passphrase) {
|
|
138
|
+
const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
139
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140
|
+
const ret = wasm.generate_user_keys(ptr0, len0);
|
|
141
|
+
if (ret[2]) {
|
|
142
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
143
|
+
}
|
|
144
|
+
return UserKeys.__wrap(ret[0]);
|
|
145
|
+
}
|
|
132
146
|
|
|
133
147
|
function _assertClass(instance, klass) {
|
|
134
148
|
if (!(instance instanceof klass)) {
|
|
135
149
|
throw new Error(`expected instance of ${klass.name}`);
|
|
136
150
|
}
|
|
137
151
|
}
|
|
152
|
+
|
|
153
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
154
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
155
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
156
|
+
WASM_VECTOR_LEN = arg.length;
|
|
157
|
+
return ptr;
|
|
158
|
+
}
|
|
138
159
|
/**
|
|
139
160
|
* Encrypts data using AES-256-SIV authenticated encryption.
|
|
140
161
|
*
|
|
@@ -185,28 +206,6 @@ export function aead_encrypt(key, nonce, plaintext, aad) {
|
|
|
185
206
|
return v3;
|
|
186
207
|
}
|
|
187
208
|
|
|
188
|
-
/**
|
|
189
|
-
* Generates user keys from a passphrase.
|
|
190
|
-
*
|
|
191
|
-
* Derives all gossip keys (DSA, KEM, Massa, EVM) in a single WASM call so
|
|
192
|
-
* the passphrase crosses the JS boundary only once.
|
|
193
|
-
* @param {string} passphrase
|
|
194
|
-
* @returns {UserKeys}
|
|
195
|
-
*/
|
|
196
|
-
export function generate_user_keys(passphrase) {
|
|
197
|
-
const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
198
|
-
const len0 = WASM_VECTOR_LEN;
|
|
199
|
-
const ret = wasm.generate_user_keys(ptr0, len0);
|
|
200
|
-
if (ret[2]) {
|
|
201
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
202
|
-
}
|
|
203
|
-
return UserKeys.__wrap(ret[0]);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export function start() {
|
|
207
|
-
wasm.start();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
209
|
/**
|
|
211
210
|
* Decrypts data using AES-256-SIV authenticated encryption.
|
|
212
211
|
*
|
|
Binary file
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function initSecureStorage(domain: string, backend: string): Promise<void>;
|
|
4
|
-
export function idbHasData(): Promise<boolean>;
|
|
5
|
-
export function provisionStorage(): void;
|
|
6
|
-
export function allocateSession(slot: number, password: Uint8Array): void;
|
|
7
|
-
export function flushEncrypted(): Promise<void>;
|
|
8
|
-
export function openDatabase(): void;
|
|
9
|
-
export function closeDatabase(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Run a SQL statement with bound parameters.
|
|
12
|
-
*
|
|
13
|
-
* `params` is a JS array of values; supported types are number, string,
|
|
14
|
-
* Uint8Array, null, and bigint. Returns rows as a JS array of arrays
|
|
15
|
-
* (positional column values), matching the Drizzle sqlite-proxy contract.
|
|
16
|
-
*/
|
|
17
|
-
export function execSql(sql: string, params: Array<any>): ExecResult;
|
|
18
|
-
export function unlockSession(password: Uint8Array): boolean;
|
|
19
|
-
export function lockSession(): void;
|
|
20
4
|
/**
|
|
21
5
|
* Permanently destroy the data of the currently unlocked slot.
|
|
22
6
|
*
|
|
@@ -33,10 +17,100 @@ export function lockSession(): void;
|
|
|
33
17
|
*/
|
|
34
18
|
export function destroySession(namespaces: Uint8Array): void;
|
|
35
19
|
export function coverTrafficTick(namespace: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Strictly validate one version-1 logical keypair record without unlocking it.
|
|
22
|
+
* Browser streaming export/import uses this bounded bridge so TypeScript never
|
|
23
|
+
* reimplements pq-rerand's canonical parser.
|
|
24
|
+
*/
|
|
25
|
+
export function validatePortableKeypair(value: Uint8Array): void;
|
|
26
|
+
export function openDatabase(): void;
|
|
27
|
+
export function closeDatabase(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Run a SQL statement with bound parameters.
|
|
30
|
+
*
|
|
31
|
+
* `params` is a JS array of values; supported types are number, string,
|
|
32
|
+
* Uint8Array, null, and bigint. Returns rows as a JS array of arrays
|
|
33
|
+
* (positional column values), matching the Drizzle sqlite-proxy contract.
|
|
34
|
+
*/
|
|
35
|
+
export function execSql(sql: string, params: Array<any>): ExecResult;
|
|
36
|
+
/**
|
|
37
|
+
* Strictly validate one version-1 encrypted block record.
|
|
38
|
+
*/
|
|
39
|
+
export function validatePortableBlock(value: Uint8Array): void;
|
|
36
40
|
export function writeNamespaceData(namespace: number, offset: number, data: Uint8Array): void;
|
|
37
41
|
export function readNamespaceData(namespace: number, offset: number, len: number): Uint8Array;
|
|
38
42
|
export function namespaceDataLength(namespace: number): number;
|
|
39
43
|
export function clearNamespace(namespace: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Verify that this worker still owns the active IndexedDB generation.
|
|
46
|
+
*/
|
|
47
|
+
export function verifyStorageGeneration(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Called by the worker when an allocation or destruction transaction rejects.
|
|
50
|
+
* This prevents a later cover-traffic flush from durably carrying the failed
|
|
51
|
+
* lifecycle operation. The recovered state is always locked.
|
|
52
|
+
*/
|
|
53
|
+
export function reloadDurableStorage(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Abandon a poisoned SQLite transaction and restore its last durable image
|
|
56
|
+
* while retaining the current unlocked session keys. No pending VFS bytes are
|
|
57
|
+
* flushed: closing SQLite rolls back its in-memory journal, then the IndexedDB
|
|
58
|
+
* cache is reloaded before a fresh database handle is opened.
|
|
59
|
+
*/
|
|
60
|
+
export function resetSqlDatabaseToDurable(): Promise<void>;
|
|
61
|
+
export function flushEncrypted(): Promise<void>;
|
|
62
|
+
export function beginOnboardingCandidate(): void;
|
|
63
|
+
export function exportOnboardingCandidate(): Uint8Array;
|
|
64
|
+
export function activateOnboardingGeneration(): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Generate fresh current-suite keypairs for all slots at once. Every public
|
|
67
|
+
* key changes, so comparing source and destination cannot reveal selection.
|
|
68
|
+
*/
|
|
69
|
+
export function finalizeOuterMigration(): Array<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Transform one complete fixed-slot block coordinate.
|
|
72
|
+
*/
|
|
73
|
+
export function migrateOuterBlockBatch(namespace: number, block_index: number, values: Array<any>): Array<any>;
|
|
74
|
+
export function finishOuterMigrationNamespace(namespace: number, source_block_count: number): void;
|
|
75
|
+
export function endOuterMigration(): void;
|
|
76
|
+
export function idbHasData(): Promise<boolean>;
|
|
77
|
+
export function provisionStorage(): void;
|
|
78
|
+
export function allocateSession(slot: number, password: Uint8Array): void;
|
|
79
|
+
export function unlockSession(password: Uint8Array): boolean;
|
|
80
|
+
export function lockSession(): void;
|
|
81
|
+
export function endOnboardingCandidate(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Replace this terminal worker's active backend with an isolated in-memory
|
|
84
|
+
* portable candidate and authenticate its keypairs without exposing the
|
|
85
|
+
* matched slot to JavaScript.
|
|
86
|
+
*/
|
|
87
|
+
export function beginCandidatePreview(domain: string, password: Uint8Array, keypairs: Array<any>): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Admit one canonical candidate block. Only namespace 0 blocks belonging to
|
|
90
|
+
* the internally authenticated slot are retained; callers never learn which
|
|
91
|
+
* slot matched.
|
|
92
|
+
*/
|
|
93
|
+
export function appendCandidatePreviewBlock(slot: number, namespace: number, block_index: number, data: Uint8Array): void;
|
|
94
|
+
/**
|
|
95
|
+
* Load the candidate namespace length and open SQLite without write authority.
|
|
96
|
+
*/
|
|
97
|
+
export function finishCandidatePreview(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Project only bounded public profile fields inside WASM. The security JSON
|
|
100
|
+
* is validated and zeroized in Rust and never crosses the worker bridge.
|
|
101
|
+
*/
|
|
102
|
+
export function queryCandidatePreview(): any;
|
|
103
|
+
export function endCandidatePreview(): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Begin password admission for one validated candidate. Only opaque plan
|
|
106
|
+
* state is retained; no transformed/mixed-version generation is emitted.
|
|
107
|
+
*/
|
|
108
|
+
export function beginOuterMigration(domain: string, keypairs: Array<any>): void;
|
|
109
|
+
/**
|
|
110
|
+
* Admit one password with all-slot constant work. The owned WASM copy is
|
|
111
|
+
* zeroized before return and a generic false discloses no matched slot.
|
|
112
|
+
*/
|
|
113
|
+
export function admitOuterMigrationPassword(password: Uint8Array): boolean;
|
|
40
114
|
export function initThreadPool(num_threads: number): Promise<any>;
|
|
41
115
|
export function wbg_rayon_start_worker(receiver: number): void;
|
|
42
116
|
/**
|
|
@@ -67,23 +141,43 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
67
141
|
|
|
68
142
|
export interface InitOutput {
|
|
69
143
|
readonly __wbg_execresult_free: (a: number, b: number) => void;
|
|
144
|
+
readonly activateOnboardingGeneration: () => any;
|
|
145
|
+
readonly admitOuterMigrationPassword: (a: number, b: number) => [number, number, number];
|
|
70
146
|
readonly allocateSession: (a: number, b: number, c: number) => [number, number];
|
|
147
|
+
readonly appendCandidatePreviewBlock: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
148
|
+
readonly beginCandidatePreview: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
|
|
149
|
+
readonly beginOnboardingCandidate: () => [number, number];
|
|
150
|
+
readonly beginOuterMigration: (a: number, b: number, c: any) => [number, number];
|
|
71
151
|
readonly clearNamespace: (a: number) => [number, number];
|
|
72
152
|
readonly closeDatabase: () => [number, number];
|
|
73
153
|
readonly coverTrafficTick: (a: number) => [number, number];
|
|
74
154
|
readonly destroySession: (a: number, b: number) => [number, number];
|
|
155
|
+
readonly endCandidatePreview: () => any;
|
|
156
|
+
readonly endOnboardingCandidate: () => [number, number];
|
|
157
|
+
readonly endOuterMigration: () => void;
|
|
75
158
|
readonly execSql: (a: number, b: number, c: any) => [number, number, number];
|
|
76
159
|
readonly execresult_lastInsertRowId: (a: number) => number;
|
|
77
160
|
readonly execresult_rows: (a: number) => any;
|
|
161
|
+
readonly exportOnboardingCandidate: () => [number, number, number, number];
|
|
162
|
+
readonly finalizeOuterMigration: () => [number, number, number];
|
|
163
|
+
readonly finishCandidatePreview: () => [number, number];
|
|
164
|
+
readonly finishOuterMigrationNamespace: (a: number, b: number) => [number, number];
|
|
78
165
|
readonly flushEncrypted: () => any;
|
|
79
166
|
readonly idbHasData: () => any;
|
|
80
167
|
readonly initSecureStorage: (a: number, b: number, c: number, d: number) => any;
|
|
81
168
|
readonly lockSession: () => [number, number];
|
|
169
|
+
readonly migrateOuterBlockBatch: (a: number, b: number, c: any) => [number, number, number];
|
|
82
170
|
readonly namespaceDataLength: (a: number) => [number, number, number];
|
|
83
171
|
readonly openDatabase: () => [number, number];
|
|
84
172
|
readonly provisionStorage: () => [number, number];
|
|
173
|
+
readonly queryCandidatePreview: () => [number, number, number];
|
|
85
174
|
readonly readNamespaceData: (a: number, b: number, c: number) => [number, number, number, number];
|
|
175
|
+
readonly reloadDurableStorage: () => any;
|
|
176
|
+
readonly resetSqlDatabaseToDurable: () => any;
|
|
86
177
|
readonly unlockSession: (a: number, b: number) => [number, number, number];
|
|
178
|
+
readonly validatePortableBlock: (a: number, b: number) => [number, number];
|
|
179
|
+
readonly validatePortableKeypair: (a: number, b: number) => [number, number];
|
|
180
|
+
readonly verifyStorageGeneration: () => any;
|
|
87
181
|
readonly writeNamespaceData: (a: number, b: number, c: number, d: number) => [number, number];
|
|
88
182
|
readonly __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
|
|
89
183
|
readonly initThreadPool: (a: number) => any;
|
|
@@ -110,11 +204,11 @@ export interface InitOutput {
|
|
|
110
204
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
111
205
|
readonly __wbindgen_export_7: WebAssembly.Table;
|
|
112
206
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
207
|
+
readonly closure127_externref_shim: (a: number, b: number, c: any) => void;
|
|
208
|
+
readonly wasm_bindgen_c8f7f980e6f4097b___convert__closures_____invoke______: (a: number, b: number) => void;
|
|
209
|
+
readonly closure83_externref_shim_multivalue_shim: (a: number, b: number, c: any) => [number, number];
|
|
210
|
+
readonly closure702_externref_shim: (a: number, b: number, c: any) => void;
|
|
211
|
+
readonly closure758_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
118
212
|
readonly __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
|
|
119
213
|
readonly __wbindgen_start: (a: number) => void;
|
|
120
214
|
}
|