@novasamatech/statement-store 0.8.4 → 0.8.6
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.
|
@@ -9,7 +9,21 @@ export type SessionParams = {
|
|
|
9
9
|
statementStore: StatementStoreAdapter;
|
|
10
10
|
encryption: Encryption;
|
|
11
11
|
prover: StatementProver;
|
|
12
|
+
/**
|
|
13
|
+
* Keyed-hash input for SessionId derivation:
|
|
14
|
+
* SessionId(A, B) = khash(sessionKey, "session" : AccountId(A) : AccountId(B) : "/" : "/")
|
|
15
|
+
*
|
|
16
|
+
* Required because blake2b's key length is bounded (≤ 64 bytes) and the
|
|
17
|
+
* caller must decide what semantically goes here. V1 sessions historically
|
|
18
|
+
* passed `remoteAccount.publicKey` (33-byte compressed P-256 — fits) which
|
|
19
|
+
* conflated the encryption pubkey with the session-derivation key. The V2
|
|
20
|
+
* spec (Mobile SSO v0.2.2) is explicit that SessionId is keyed by the
|
|
21
|
+
* ECDH-derived shared secret, so V2 callers should pass that 32-byte value
|
|
22
|
+
* directly. Pass any 32–64 byte material; out-of-range inputs make blake2b
|
|
23
|
+
* throw.
|
|
24
|
+
*/
|
|
25
|
+
sessionKey: Uint8Array;
|
|
12
26
|
maxRequestSize?: number;
|
|
13
27
|
};
|
|
14
28
|
export declare function nextExpiry(current: bigint): bigint;
|
|
15
|
-
export declare function createSession({ localAccount, remoteAccount, statementStore, encryption, prover, maxRequestSize, }: SessionParams): Session;
|
|
29
|
+
export declare function createSession({ localAccount, remoteAccount, statementStore, encryption, prover, sessionKey, maxRequestSize, }: SessionParams): Session;
|
package/dist/session/session.js
CHANGED
|
@@ -14,9 +14,9 @@ export function nextExpiry(current) {
|
|
|
14
14
|
const fresh = createExpiryFromDuration(DEFAULT_EXPIRY_DURATION_SECS);
|
|
15
15
|
return fresh > current ? fresh : current + 1n;
|
|
16
16
|
}
|
|
17
|
-
export function createSession({ localAccount, remoteAccount, statementStore, encryption, prover, maxRequestSize = DEFAULT_MAX_REQUEST_SIZE, }) {
|
|
18
|
-
const outgoingSessionId = createSessionId(
|
|
19
|
-
const incomingSessionId = createSessionId(
|
|
17
|
+
export function createSession({ localAccount, remoteAccount, statementStore, encryption, prover, sessionKey, maxRequestSize = DEFAULT_MAX_REQUEST_SIZE, }) {
|
|
18
|
+
const outgoingSessionId = createSessionId(sessionKey, localAccount, remoteAccount);
|
|
19
|
+
const incomingSessionId = createSessionId(sessionKey, remoteAccount, localAccount);
|
|
20
20
|
const state = {
|
|
21
21
|
phase: 'initialization',
|
|
22
22
|
initError: null,
|
|
@@ -57,6 +57,9 @@ function makeSession(overrides) {
|
|
|
57
57
|
statementStore: adapter,
|
|
58
58
|
encryption: mockEncryption(),
|
|
59
59
|
prover: mockProver,
|
|
60
|
+
// Preserve the pre-refactor SessionId derivation (keyed on the peer's
|
|
61
|
+
// encryption pubkey) so existing channel/topic assertions hold.
|
|
62
|
+
sessionKey: remoteAccount.publicKey,
|
|
60
63
|
maxRequestSize,
|
|
61
64
|
});
|
|
62
65
|
return { session, adapter };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/statement-store",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.6",
|
|
5
5
|
"description": "Statement store integration",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@novasamatech/scale": "0.8.
|
|
28
|
+
"@novasamatech/scale": "0.8.6",
|
|
29
29
|
"@novasamatech/sdk-statement": "^0.6.0",
|
|
30
|
-
"@novasamatech/substrate-slot-sr25519-wasm": "0.8.
|
|
30
|
+
"@novasamatech/substrate-slot-sr25519-wasm": "0.8.6",
|
|
31
31
|
"@polkadot-api/substrate-bindings": "^0.20.3",
|
|
32
32
|
"@polkadot-api/substrate-client": "^0.7.0",
|
|
33
33
|
"@polkadot-labs/hdkd-helpers": "^0.0.30",
|