stawi_finance_sdk
Pure-Dart client SDK for Stawi: canonical FinancialIntent encoding and
digests, account derivation, policy hashes, protocol manifest verification,
exact money arithmetic and device signing. No Flutter and no transport; pair
it with stawi_api for the Connect clients.
Signing a prepared settlement call
import 'package:stawi_finance_sdk/stawi_finance_sdk.dart';
// Once per device; persist key.privateKey in secure storage.
final key = DeviceKey.generate(); // Random.secure(), rejects 0 and >= n
print(bytesToHex0x(key.address)); // keccak256(X โ Y)[12:]
// PrepareRoomCallResponse.digest or PrepareAccountCallResponse.intent_digest:
final signature = signPreparedCall(preparedDigest, key.privateKey);
// 65 bytes r โ s โ v, v in {27, 28}: DeviceSignature.signature
// (algorithm "secp256k1") for SubmitRoomCall, or SubmitAccountCall.authorization.
accountWrappedHash(account, chainId, hash) is StawiAccount's ERC-1271
wrapping, for checking a prepared digest against the call's typed hash.
Every primitive is checked against vectors produced by the Go
implementation (test/vectors/).
Libraries
- stawi_finance_sdk
- Stawi client SDK (architecture ยง19.1): canonical FinancialIntent encoding and digest, account derivation, policy hashes, protocol manifest verification, exact money arithmetic and device signing. Pure Dart; no Flutter and no transport.