@the9ines/bolt-core 0.6.0 → 0.6.1
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/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/wasm-crypto.d.ts +11 -0
- package/dist/wasm-crypto.js +15 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type { IdentityKeyPair } from './identity.js';
|
|
|
9
9
|
export { BoltError, EncryptionError, ConnectionError, TransferError, IntegrityError } from './errors.js';
|
|
10
10
|
export { WIRE_ERROR_CODES, isValidWireErrorCode } from './errors.js';
|
|
11
11
|
export type { WireErrorCode } from './errors.js';
|
|
12
|
-
export { initWasmCrypto, initWasmCryptoFromModule, getWasmCrypto, getWasmModule, createWasmBtrEngine, createWasmSendSession } from './wasm-crypto.js';
|
|
12
|
+
export { initWasmCrypto, initWasmCryptoFromModule, getWasmCrypto, getWasmModule, createWasmBtrEngine, createWasmSendSession, getProtocolAuthorityMode } from './wasm-crypto.js';
|
|
13
|
+
export type { ProtocolAuthorityMode } from './wasm-crypto.js';
|
|
13
14
|
export type { WasmCryptoAdapter, WasmBtrEngineHandle, WasmBtrTransferCtxHandle, WasmSendSessionHandle } from './wasm-crypto.js';
|
|
14
15
|
export * from './btr/index.js';
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,6 @@ export { BoltError, EncryptionError, ConnectionError, TransferError, IntegrityEr
|
|
|
17
17
|
// Wire error code registry (PROTOCOL.md §10)
|
|
18
18
|
export { WIRE_ERROR_CODES, isValidWireErrorCode } from './errors.js';
|
|
19
19
|
// WASM protocol adapter (RUSTIFY-BROWSER-CORE-1 RB3+RB4)
|
|
20
|
-
export { initWasmCrypto, initWasmCryptoFromModule, getWasmCrypto, getWasmModule, createWasmBtrEngine, createWasmSendSession } from './wasm-crypto.js';
|
|
20
|
+
export { initWasmCrypto, initWasmCryptoFromModule, getWasmCrypto, getWasmModule, createWasmBtrEngine, createWasmSendSession, getProtocolAuthorityMode } from './wasm-crypto.js';
|
|
21
21
|
// Bolt Transfer Ratchet (BTR) — §16
|
|
22
22
|
export * from './btr/index.js';
|
package/dist/wasm-crypto.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ export interface WasmCryptoAdapter {
|
|
|
28
28
|
* Callers should fall back to TS crypto if this returns null.
|
|
29
29
|
*/
|
|
30
30
|
export declare function getWasmCrypto(): WasmCryptoAdapter | null;
|
|
31
|
+
/** BR3: Protocol authority mode for runtime observability. */
|
|
32
|
+
export type ProtocolAuthorityMode = 'wasm' | 'ts-fallback' | 'not-initialized';
|
|
33
|
+
/**
|
|
34
|
+
* BR3: Query the current protocol authority mode.
|
|
35
|
+
*
|
|
36
|
+
* Returns:
|
|
37
|
+
* - 'wasm': Rust/WASM protocol authority active (all crypto, BTR, transfer SM via Rust)
|
|
38
|
+
* - 'ts-fallback': WASM init was attempted but failed; TS tweetnacl/BTR is authoritative
|
|
39
|
+
* - 'not-initialized': initProtocolWasm() has not been called yet
|
|
40
|
+
*/
|
|
41
|
+
export declare function getProtocolAuthorityMode(): ProtocolAuthorityMode;
|
|
31
42
|
/**
|
|
32
43
|
* Initialize WASM crypto from a pre-loaded WASM module.
|
|
33
44
|
*
|
package/dist/wasm-crypto.js
CHANGED
|
@@ -18,6 +18,21 @@ let _initAttempted = false;
|
|
|
18
18
|
export function getWasmCrypto() {
|
|
19
19
|
return _wasmCrypto;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* BR3: Query the current protocol authority mode.
|
|
23
|
+
*
|
|
24
|
+
* Returns:
|
|
25
|
+
* - 'wasm': Rust/WASM protocol authority active (all crypto, BTR, transfer SM via Rust)
|
|
26
|
+
* - 'ts-fallback': WASM init was attempted but failed; TS tweetnacl/BTR is authoritative
|
|
27
|
+
* - 'not-initialized': initProtocolWasm() has not been called yet
|
|
28
|
+
*/
|
|
29
|
+
export function getProtocolAuthorityMode() {
|
|
30
|
+
if (_wasmCrypto)
|
|
31
|
+
return 'wasm';
|
|
32
|
+
if (_initAttempted)
|
|
33
|
+
return 'ts-fallback';
|
|
34
|
+
return 'not-initialized';
|
|
35
|
+
}
|
|
21
36
|
/**
|
|
22
37
|
* Initialize WASM crypto from a pre-loaded WASM module.
|
|
23
38
|
*
|