@terminal3/t3n-sdk 3.9.0 → 3.10.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/README.md +14 -2
- package/dist/index.d.ts +30 -6
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -103,10 +103,10 @@ const did = await client.authenticate(
|
|
|
103
103
|
|
|
104
104
|
The SDK targets the public T3n networks.
|
|
105
105
|
|
|
106
|
-
- `
|
|
106
|
+
- `sandbox` — the public test network, for integration and pre-production use.
|
|
107
107
|
- `production` — the public mainnet network.
|
|
108
108
|
|
|
109
|
-
Select the network with `setEnvironment("
|
|
109
|
+
Select the network with `setEnvironment("sandbox" | "production")` — this sets the
|
|
110
110
|
default node used by clients created afterwards. To target a specific node, pass an
|
|
111
111
|
explicit `baseUrl` to `new T3nClient({ baseUrl, … })`; `baseUrl` takes precedence over
|
|
112
112
|
the environment default.
|
|
@@ -156,6 +156,18 @@ try {
|
|
|
156
156
|
For tests that "just want it to work", `runOtpThenUserInput` chains the three
|
|
157
157
|
calls behind a single `getOtpCode` callback.
|
|
158
158
|
|
|
159
|
+
### Email-OTP login: skip the user-layer OTP
|
|
160
|
+
|
|
161
|
+
The example above is for a **wallet / OIDC** session proving an email for the
|
|
162
|
+
first time. If the session instead logged in via email-OTP
|
|
163
|
+
(`authenticate(createEmailOtpAuthInput(...))`), the node already proved that
|
|
164
|
+
email during login and sent the only OTP code. For that email,
|
|
165
|
+
`submitUserInput` passes the verified-email gate on the session authenticator
|
|
166
|
+
alone and the node auto-stamps `verified_contacts.email` — so call it directly,
|
|
167
|
+
with **no** `otpRequest` / `otpVerify` in between (those would send a redundant
|
|
168
|
+
second OTP email). Use the user-layer OTP only to verify a contact the session
|
|
169
|
+
has not already proven — a phone, or an email on a wallet/OIDC session.
|
|
170
|
+
|
|
159
171
|
## License
|
|
160
172
|
|
|
161
173
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1840,6 +1840,14 @@ declare class T3nClient {
|
|
|
1840
1840
|
* when the node is configured with `skip_otp = true`). The next
|
|
1841
1841
|
* step is {@link otpVerify} with the code the user typed.
|
|
1842
1842
|
*
|
|
1843
|
+
* Do NOT call this to re-verify the email a session already
|
|
1844
|
+
* authenticated with via email-OTP: that email is
|
|
1845
|
+
* already proven by the login authenticator, so this call only
|
|
1846
|
+
* dispatches a redundant SECOND OTP email. For an email-OTP login,
|
|
1847
|
+
* go straight to {@link submitUserInput}. Use `otpRequest` to
|
|
1848
|
+
* verify a contact the session has NOT already proven — a phone, or
|
|
1849
|
+
* an email on a wallet/OIDC session.
|
|
1850
|
+
*
|
|
1843
1851
|
* Behaviour notes:
|
|
1844
1852
|
*
|
|
1845
1853
|
* - Contact is a discriminated object: `emailChannel` or
|
|
@@ -1923,10 +1931,18 @@ declare class T3nClient {
|
|
|
1923
1931
|
* verified email — either because {@link otpVerify} bound one or
|
|
1924
1932
|
* because the session carries a proving authenticator (OIDC /
|
|
1925
1933
|
* Email auth). Calls without proof are rejected with
|
|
1926
|
-
* {@link UserUpsertError} `kind = "EmailNotVerified"`.
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1934
|
+
* {@link UserUpsertError} `kind = "EmailNotVerified"`.
|
|
1935
|
+
*
|
|
1936
|
+
* Two recommended flows depending on how the session logged in:
|
|
1937
|
+
* - **Email-OTP login** ({@link createEmailOtpAuthInput}): the
|
|
1938
|
+
* login already proved the email (and sent the only OTP email),
|
|
1939
|
+
* so call `submitUserInput` DIRECTLY — the gate passes on the
|
|
1940
|
+
* session authenticator and `verified_contacts.email` is
|
|
1941
|
+
* auto-stamped. Do NOT call {@link otpRequest} first; that sends
|
|
1942
|
+
* a redundant second OTP email.
|
|
1943
|
+
* - **Wallet / OIDC login** (no proven email yet): "request OTP ->
|
|
1944
|
+
* verify OTP -> submit user input" (or use
|
|
1945
|
+
* {@link runOtpThenUserInput} which chains all three).
|
|
1930
1946
|
*
|
|
1931
1947
|
* The KYC webhook orphan-attestation flow stays here: when
|
|
1932
1948
|
* `requireExistingUser` is set, the contract identifies the user
|
|
@@ -1956,6 +1972,14 @@ declare class T3nClient {
|
|
|
1956
1972
|
* {@link otpRequest}, {@link otpVerify}, and
|
|
1957
1973
|
* {@link submitUserInput} explicitly so the application owns the
|
|
1958
1974
|
* flow.
|
|
1975
|
+
*
|
|
1976
|
+
* Do NOT use this for the email a session authenticated with via
|
|
1977
|
+
* email-OTP login: it always runs {@link otpRequest},
|
|
1978
|
+
* which dispatches a redundant second OTP email for an
|
|
1979
|
+
* already-proven email. For an email-OTP login, call
|
|
1980
|
+
* {@link submitUserInput} directly. This helper is for sessions
|
|
1981
|
+
* that still need to prove the contact (phone, or an email on a
|
|
1982
|
+
* wallet/OIDC session).
|
|
1959
1983
|
*/
|
|
1960
1984
|
runOtpThenUserInput(args: {
|
|
1961
1985
|
channel: OtpChannel;
|
|
@@ -2969,7 +2993,7 @@ declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
|
2969
2993
|
*/
|
|
2970
2994
|
declare function assertShape<T>(value: unknown, guard: (v: unknown) => v is T, where: string): T;
|
|
2971
2995
|
|
|
2972
|
-
type Environment = "testnet" | "production";
|
|
2996
|
+
type Environment = "sandbox" | "testnet" | "production";
|
|
2973
2997
|
declare const NODE_URLS: Record<Environment, string>;
|
|
2974
2998
|
|
|
2975
2999
|
/**
|
|
@@ -3137,7 +3161,7 @@ declare function clearKeyCache(): void;
|
|
|
3137
3161
|
*/
|
|
3138
3162
|
declare function loadConfig(baseUrl?: string): SdkConfig;
|
|
3139
3163
|
|
|
3140
|
-
type TenantSdkEnvironment = "testnet" | "production";
|
|
3164
|
+
type TenantSdkEnvironment = "sandbox" | "testnet" | "production";
|
|
3141
3165
|
|
|
3142
3166
|
/**
|
|
3143
3167
|
* Minimal structural seam for the authenticated base client a TenantClient
|