Skip to content

Commit be8692f

Browse files
committed
update readme
1 parent 82cceb1 commit be8692f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

Sources/TurnkeySwift/README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Then in your views, access it via:
4343
* `com.turnkey.sdk.sessionKeys`: Registry of stored sessions
4444
* `com.turnkey.sdk.pendingList`: Pending ephemeral key list
4545
* `com.turnkey.sdk.selectedSession`: Selected active session key
46+
* `com.turnkey.sdk.autoRefresh`: Tracks which sessions have auto-refresh enabled and the associated refresh duration
4647

4748
---
4849

@@ -54,9 +55,10 @@ Then in your views, access it via:
5455

5556
* Generates a new ephemeral key pair and saves the private key securely.
5657

57-
* `createSession(jwt:sessionKey:)`
58+
* `createSession(jwt:sessionKey:refreshedSessionTTLSeconds:)`
5859

5960
* Creates and stores a session from a JWT.
61+
* Optionally sets up automatic refresh behavior if `refreshedSessionTTLSeconds` is provided. This value defines how long each refreshed session will last and must be at least 30 seconds.
6062

6163
* `setSelectedSession(sessionKey:) -> TurnkeyClient`
6264

@@ -66,13 +68,9 @@ Then in your views, access it via:
6668

6769
* Clears the specified session and resets state.
6870

69-
* `refreshUser()`
70-
71-
* Refreshes the user and wallet state for the selected session.
71+
* `refreshSession(expirationSeconds:sessionKey:invalidateExisting:)`
7272

73-
* `updateUser(email:phone:)`
74-
75-
* Updates the session user's metadata.
73+
* Manually refreshes the selected session. Useful when rotating credentials.
7674

7775
### User Management
7876

@@ -84,6 +82,14 @@ Then in your views, access it via:
8482

8583
* Updates the user contact details.
8684

85+
* `updateUserEmail(email:verificationToken:)`
86+
87+
* Updates the user's email address. If a verification token is provided, the email is marked as verified. Passing an empty string will delete the user's email.
88+
89+
* `updateUserPhoneNumber(phone:verificationToken:)`
90+
91+
* Updates the user's phone number. If a verification token is provided, the phone number is marked as verified. Passing an empty string will delete the user's phone number.
92+
8793
### Wallet Management
8894

8995
* `createWallet(walletName:accounts:mnemonicLength:)`
@@ -129,9 +135,12 @@ public typealias Timestamp = Components.Schemas.external_period_data_period_v1_p
129135

130136
## Session Expiry Handling
131137

132-
Each session schedules a timer to automatically clear itself 5 seconds before JWT expiry. You can optionally observe session state via `@Published` properties on `TurnkeyContext`:
138+
Each session schedules a timer to automatically clear itself 5 seconds before JWT expiry. If `refreshedSessionTTLSeconds` was provided when creating the session, the SDK will automatically refresh the session before it expires, as long as the app is active.
139+
140+
You can optionally observe session state via `@Published` properties on `TurnkeyContext`:
133141

134142
```swift
143+
@Published public internal(set) var authState: AuthState
135144
@Published public internal(set) var selectedSessionKey: String?
136145
@Published public internal(set) var user: SessionUser?
137146
@Published public internal(set) var client: TurnkeyClient?

0 commit comments

Comments
 (0)