Skip to content

Commit d6cc8a6

Browse files
Update the WAAS client and rename the SDK to OMS Wallet (#15)
* Update the C SDK for the latest WAAS wallet client * Refresh docs for the latest WAAS wallet flow * Clean up stale WAAS flow docs * Rename the SDK surface to OMS Wallet * Harden session restore and persistence semantics
1 parent 978051f commit d6cc8a6

63 files changed

Lines changed: 2520 additions & 1775 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/linux-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/checkout@v4
3434

3535
- name: Configure
36-
run: cmake -S . -B build -DSEQUENCE_BUILD_DEMO=OFF -DSEQUENCE_BUILD_CLI=OFF
36+
run: cmake -S . -B build -DOMS_WALLET_BUILD_DEMO=OFF -DOMS_WALLET_BUILD_CLI=OFF
3737

3838
- name: Build
3939
run: cmake --build build

CMakeLists.txt

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.20)
2-
project(sequence-c-sdk C)
2+
project(oms_wallet_c_sdk C)
33

44
set(CMAKE_C_STANDARD 99)
55

@@ -13,19 +13,19 @@ pkg_check_modules(SECP256K1 REQUIRED libsecp256k1)
1313
pkg_check_modules(CJSON REQUIRED IMPORTED_TARGET libcjson)
1414
link_directories(${SECP256K1_LIBRARY_DIRS})
1515

16-
option(SEQUENCE_BUILD_DEMO "Build demo target" ON)
17-
option(SEQUENCE_BUILD_CLI "Build CLI target" ON)
16+
option(OMS_WALLET_BUILD_DEMO "Build demo target" ON)
17+
option(OMS_WALLET_BUILD_CLI "Build CLI target" ON)
1818

1919
# ---- Library ----
2020

21-
set(SEQUENCE_SDK_SOURCES
21+
set(OMS_WALLET_SDK_SOURCES
2222
lib/generated/waas/waas.gen.c
23-
lib/runtime/sequence_runtime.c
24-
lib/wallet/sequence_auth.c
25-
lib/wallet/sequence_config.c
26-
lib/wallet/sequence_request_signing.c
27-
lib/wallet/sequence_wallet_ops.c
28-
lib/wallet/sequence_wallet_shared.c
23+
lib/runtime/oms_wallet_runtime.c
24+
lib/wallet/oms_wallet_auth.c
25+
lib/wallet/oms_wallet_config.c
26+
lib/wallet/oms_wallet_request_signing.c
27+
lib/wallet/oms_wallet_ops.c
28+
lib/wallet/oms_wallet_shared.c
2929
lib/networking/http_client.c
3030
lib/networking/http_client_common.c
3131
lib/infrastructure/is_valid_message_signature.c
@@ -37,109 +37,113 @@ set(SEQUENCE_SDK_SOURCES
3737
lib/evm/keccak256.c
3838
lib/evm/sign_message.c
3939
lib/utils/byte_utils.c
40+
lib/utils/base64url.c
4041
lib/utils/globals.c
4142
lib/utils/hex_utils.c
43+
lib/utils/sha256.c
4244
lib/utils/string_utils.c
4345
lib/utils/timestamps.c
4446
lib/utils/uuid.c
4547
)
4648

4749
if(APPLE)
48-
list(APPEND SEQUENCE_SDK_SOURCES
50+
list(APPEND OMS_WALLET_SDK_SOURCES
4951
lib/storage/secure_storage.c
5052
)
5153
elseif(UNIX)
52-
list(APPEND SEQUENCE_SDK_SOURCES
54+
list(APPEND OMS_WALLET_SDK_SOURCES
5355
lib/storage/secure_storage_posix.c
5456
)
5557
else()
56-
message(FATAL_ERROR "sequence-c-sdk currently supports macOS and Linux only")
58+
message(FATAL_ERROR "oms-wallet-c-sdk currently supports macOS and Linux only")
5759
endif()
5860

59-
add_library(sequence_c_sdk ${SEQUENCE_SDK_SOURCES})
61+
add_library(oms_wallet_c_sdk ${OMS_WALLET_SDK_SOURCES})
6062

61-
target_include_directories(sequence_c_sdk
63+
target_include_directories(oms_wallet_c_sdk
6264
PUBLIC
6365
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>
64-
$<INSTALL_INTERFACE:include>
66+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/oms-wallet>
6567
${SECP256K1_INCLUDE_DIRS}
6668
${CJSON_INCLUDE_DIRS}
6769
)
6870

69-
target_compile_options(sequence_c_sdk PUBLIC
71+
target_compile_options(oms_wallet_c_sdk PUBLIC
7072
${SECP256K1_CFLAGS_OTHER}
7173
${CJSON_CFLAGS_OTHER}
7274
)
7375

74-
target_link_libraries(sequence_c_sdk PUBLIC
76+
target_link_libraries(oms_wallet_c_sdk PUBLIC
7577
CURL::libcurl
7678
PkgConfig::CJSON
7779
${SECP256K1_LIBRARIES}
7880
)
7981

8082
# macOS frameworks
8183
if(APPLE)
82-
target_link_libraries(sequence_c_sdk PUBLIC
84+
target_link_libraries(oms_wallet_c_sdk PUBLIC
8385
"-framework Security"
8486
"-framework CoreFoundation"
8587
)
8688
endif()
8789

8890
# ---- Demo ----
8991

90-
set(SEQUENCE_RUNTIME_TARGETS "")
92+
set(OMS_WALLET_RUNTIME_TARGETS "")
9193

92-
if(SEQUENCE_BUILD_DEMO)
93-
add_executable(sequence-demo demo.c)
94-
target_link_libraries(sequence-demo PRIVATE sequence_c_sdk)
95-
list(APPEND SEQUENCE_RUNTIME_TARGETS sequence-demo)
94+
if(OMS_WALLET_BUILD_DEMO)
95+
add_executable(oms_wallet_demo demo.c)
96+
target_link_libraries(oms_wallet_demo PRIVATE oms_wallet_c_sdk)
97+
set_target_properties(oms_wallet_demo PROPERTIES OUTPUT_NAME "oms-wallet-demo")
98+
list(APPEND OMS_WALLET_RUNTIME_TARGETS oms_wallet_demo)
9699
endif()
97100

98101
# ---- CLI ----
99102

100-
if(SEQUENCE_BUILD_CLI)
101-
add_executable(sequence-wallet cli.c)
102-
target_link_libraries(sequence-wallet PRIVATE sequence_c_sdk)
103-
list(APPEND SEQUENCE_RUNTIME_TARGETS sequence-wallet)
103+
if(OMS_WALLET_BUILD_CLI)
104+
add_executable(oms_wallet_cli cli.c)
105+
target_link_libraries(oms_wallet_cli PRIVATE oms_wallet_c_sdk)
106+
set_target_properties(oms_wallet_cli PROPERTIES OUTPUT_NAME "oms-wallet")
107+
list(APPEND OMS_WALLET_RUNTIME_TARGETS oms_wallet_cli)
104108
endif()
105109

106110
# ---- Install ----
107111

108-
install(TARGETS sequence_c_sdk
109-
EXPORT sequence-c-sdk-targets
112+
install(TARGETS oms_wallet_c_sdk
113+
EXPORT oms-wallet-c-sdk-targets
110114
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
111115
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
112116

113-
if(SEQUENCE_RUNTIME_TARGETS)
114-
install(TARGETS ${SEQUENCE_RUNTIME_TARGETS}
117+
if(OMS_WALLET_RUNTIME_TARGETS)
118+
install(TARGETS ${OMS_WALLET_RUNTIME_TARGETS}
115119
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
116120
endif()
117121

118122
install(DIRECTORY lib/
119-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sequence
123+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oms-wallet
120124
FILES_MATCHING PATTERN "*.h"
121-
PATTERN "sequence_wallet_internal.h" EXCLUDE)
125+
PATTERN "oms_wallet_internal.h" EXCLUDE)
122126

123-
install(EXPORT sequence-c-sdk-targets
124-
FILE sequence-c-sdk-targets.cmake
125-
NAMESPACE sequence::
126-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/sequence-c-sdk)
127+
install(EXPORT oms-wallet-c-sdk-targets
128+
FILE oms-wallet-c-sdk-targets.cmake
129+
NAMESPACE oms_wallet::
130+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/oms-wallet-c-sdk)
127131

128132
if(BUILD_TESTING)
129-
add_executable(sequence_request_signing_test
130-
tests/sequence_request_signing_test.c)
131-
target_link_libraries(sequence_request_signing_test PRIVATE sequence_c_sdk)
132-
add_test(NAME sequence_request_signing_test COMMAND sequence_request_signing_test)
133+
add_executable(oms_wallet_request_signing_test
134+
tests/oms_wallet_request_signing_test.c)
135+
target_link_libraries(oms_wallet_request_signing_test PRIVATE oms_wallet_c_sdk)
136+
add_test(NAME oms_wallet_request_signing_test COMMAND oms_wallet_request_signing_test)
133137

134138
add_executable(timestamps_test
135139
tests/timestamps_test.c)
136-
target_link_libraries(timestamps_test PRIVATE sequence_c_sdk)
140+
target_link_libraries(timestamps_test PRIVATE oms_wallet_c_sdk)
137141
add_test(NAME timestamps_test COMMAND timestamps_test)
138142

139143
if(UNIX AND NOT APPLE)
140144
add_executable(secure_storage_test
141145
tests/secure_storage_test.c)
142-
target_link_libraries(secure_storage_test PRIVATE sequence_c_sdk)
146+
target_link_libraries(secure_storage_test PRIVATE oms_wallet_c_sdk)
143147
add_test(NAME secure_storage_test COMMAND secure_storage_test)
144148
endif()
145149
endif()

Formula/wallet.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Wallet < Formula
2-
desc "Sequence C SDK"
2+
desc "OmsWallet C SDK"
33
homepage "https://github.com/0xsequence/c-sdk"
44
url "https://github.com/0xsequence/c-sdk/archive/refs/tags/v0.3.0.tar.gz"
55
sha256 "e4949620a97b2952ec774280df2344c5a047d4e96a19c8019f96e9a0c365996c"
@@ -18,6 +18,6 @@ def install
1818

1919
test do
2020
# Basic smoke test
21-
assert_match "Usage", shell_output("#{bin}/sequence-wallet --help")
21+
assert_match "Usage", shell_output("#{bin}/oms-wallet --help")
2222
end
2323
end

README.md

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Sequence C SDK
1+
# OmsWallet C SDK
22

33
## Support Matrix
44

@@ -36,39 +36,47 @@ cmake --build build
3636
Optional targets:
3737

3838
```shell
39-
cmake -S . -B build -DSEQUENCE_BUILD_DEMO=OFF -DSEQUENCE_BUILD_CLI=OFF
39+
cmake -S . -B build -DOMS_WALLET_BUILD_DEMO=OFF -DOMS_WALLET_BUILD_CLI=OFF
4040
```
4141

42-
`SEQUENCE_BUILD_DEMO` and `SEQUENCE_BUILD_CLI` only control those runtime
42+
`OMS_WALLET_BUILD_DEMO` and `OMS_WALLET_BUILD_CLI` only control those runtime
4343
binaries. They do not disable the library or the test targets.
4444

4545
## Initialization
4646

47-
Call `sequence_config_init(...)` before using wallet, indexer, or API helpers.
47+
Call `oms_wallet_config_init(...)` before using wallet, indexer, or API helpers.
4848
The SDK no longer falls back to built-in runtime URLs when config is unset.
4949

5050
Minimal setup:
5151

5252
```c
53-
#include "wallet/sequence_config.h"
53+
#include <wallet/oms_wallet_config.h>
5454

55-
if (sequence_config_init("YOUR_ACCESS_KEY") != 0) {
55+
if (oms_wallet_config_init("YOUR_ACCESS_KEY") != 0) {
5656
/* handle config initialization failure */
5757
}
5858
```
5959

6060
Common overrides:
6161

6262
```c
63-
sequence_config_set_indexer_url_template("https://dev-{value}-indexer.sequence.app/rpc/Indexer/");
64-
sequence_config_set_api_rpc_url("https://dev-api.sequence.app/rpc/API");
65-
sequence_config_set_wallet_rpc_url("https://your-wallet-host/rpc/Wallet");
66-
sequence_config_set_wallet_auth_scope("@1:test");
67-
sequence_config_set_origin_header("Origin: http://localhost:3000");
68-
sequence_config_set_storage_dir("/var/lib/sequence-c-sdk");
63+
oms_wallet_config_set_indexer_url_template("https://dev-{value}-indexer.sequence.app/rpc/Indexer/");
64+
oms_wallet_config_set_api_rpc_url("https://dev-api.sequence.app/rpc/API");
65+
oms_wallet_config_set_wallet_rpc_url("https://your-wallet-host/rpc/Wallet");
66+
oms_wallet_config_set_origin_header("Origin: http://localhost:3000");
67+
oms_wallet_config_set_storage_dir("/var/lib/oms-wallet-c-sdk");
6968
```
7069
71-
Call `sequence_config_cleanup()` when you are done with SDK-owned config state.
70+
The default wallet auth scope is `proj_1`. Only override it if your environment
71+
requires a different scope.
72+
73+
Call `oms_wallet_config_cleanup()` when you are done with SDK-owned config state.
74+
75+
`oms_wallet_restore_session()` returns:
76+
77+
- `1` when a usable saved session was restored
78+
- `0` when no usable saved session exists yet
79+
- `-1` on an actual storage or restore failure
7280
7381
## Linux Secure Storage
7482
@@ -78,73 +86,81 @@ On Linux, secure storage uses a file-per-key backend with:
7886
- file permissions: `0600`
7987
- atomic replace on write
8088
89+
This Linux backend is permission-protected filesystem storage. It is not
90+
encrypted at rest like macOS Keychain storage.
91+
8192
Default storage path:
8293
83-
- `$HOME/.sequence-c-sdk` when `HOME` is set
84-
- `./.sequence-c-sdk` otherwise
94+
- `$HOME/.oms-wallet-c-sdk` when `HOME` is set
95+
- `./.oms-wallet-c-sdk` otherwise
8596
8697
Override the storage location with:
8798
8899
```c
89-
sequence_config_set_storage_dir("/path/to/app-state");
100+
oms_wallet_config_set_storage_dir("/path/to/app-state");
90101
```
91102

92-
#### Temporary generated-client patch
93-
94-
The vendored generated WAAS C client currently includes a small local
95-
compatibility patch in `lib/generated/waas/waas.gen.c` to tolerate a missing
96-
`iss` field in the live `CompleteAuth` response.
103+
Persisted keys used by the SDK:
97104

98-
This is temporary and should be removed once the WAAS API contract is updated
99-
or fixed upstream.
105+
- `access-key`: CLI-stored access key used to initialize SDK config
106+
- `seckey`: signer private key for the current session
107+
- `challenge`: pending email sign-in challenge
108+
- `verifier`: pending email sign-in verifier
109+
- `oms_wallet_id`: selected wallet id for follow-up wallet operations
110+
- `oms_wallet_address`: last selected wallet address
100111

101112
#### Run tests
102113

103114
```shell
104115
ctest --test-dir build --output-on-failure
105116

106117
# Focused request-signing parity test
107-
./build/sequence_request_signing_test
118+
./build/oms_wallet_request_signing_test
108119
```
109120

110121
Current test coverage:
111122

112-
- `sequence_request_signing_test`: validates canonical request payloads, preimages, digests, signatures, and authorization headers against checked-in vectors
123+
- `oms_wallet_request_signing_test`: validates canonical request payloads, preimages, digests, signatures, and authorization headers against checked-in vectors
113124
- `timestamps_test`: validates nonce monotonicity from `timestamp_next_nonce()`
125+
- `secure_storage_test`: Linux-only regression test for the POSIX secure-storage backend
114126

115127
#### Run the demo or cli
116128

117129
```shell
118-
./build/sequence-demo
130+
./build/oms-wallet-demo
119131
```
120132

121133
```shell
122134
# Init
123-
./build/sequence-wallet init --access-key AQAAAAAAAAK2JvvZhWqZ51riasWBftkrVXE
135+
./build/oms-wallet init --access-key AQAAAAAAAAK2JvvZhWqZ51riasWBftkrVXE
124136

125137
# Get token balances
126-
./build/sequence-wallet get-token-balances --chain-id 137 --contract-address 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 --wallet-address 0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9 --include-metadata
138+
./build/oms-wallet get-token-balances --chain-id 137 --contract-address 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 --wallet-address 0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9 --include-metadata
127139

128140
# Sign in with Email
129-
./build/sequence-wallet sign-in-with-email --email andygruening@gmail.com
141+
./build/oms-wallet sign-in-with-email --email andygruening@gmail.com
142+
143+
# Confirm Email sign in and automatically select the first matching wallet,
144+
# or create one if none exists for that type
145+
./build/oms-wallet confirm-email-sign-in --code 123456 --wallet-type ethereum
130146

131-
# Confirm Email sign in
132-
./build/sequence-wallet confirm-email-sign-in --code 123456 --wallet-type Ethereum_EOA
147+
# Or, omit --wallet-type to list the available wallets returned by CompleteAuth
148+
./build/oms-wallet confirm-email-sign-in --code 123456
133149

134-
# Use wallet
135-
./build/sequence-wallet use-wallet --wallet-type Ethereum_EOA
150+
# Optional: switch to a specific wallet later
151+
./build/oms-wallet use-wallet --wallet-id <wallet-id>
136152

137-
# Create wallet
138-
./build/sequence-wallet create-wallet
153+
# Optional: create an additional wallet of the default type (ethereum)
154+
./build/oms-wallet create-wallet
139155

140156
# Sign message
141-
./build/sequence-wallet sign-message --chain-id 80002 --message test
157+
./build/oms-wallet sign-message --chain-id 80002 --message test
142158

143159
# Verify signature
144-
./build/sequence-wallet verify-signature --chain-id 80002 --wallet-address 0xb7461CcfFfc7378747C6f82804E4dEc04b9E6148 --message test --signature 0x...
160+
./build/oms-wallet verify-signature --chain-id 80002 --wallet-address 0xb7461CcfFfc7378747C6f82804E4dEc04b9E6148 --message test --signature 0x...
145161

146162
# Send transaction
147-
./build/sequence-wallet send-transaction --chain-id 80002 --to 0xE5E8B483FfC05967FcFed58cc98D053265af6D99 --value 0
163+
./build/oms-wallet send-transaction --chain-id 80002 --to 0xE5E8B483FfC05967FcFed58cc98D053265af6D99 --value 0
148164
```
149165

150166
#### Homebrew version release

0 commit comments

Comments
 (0)