@fonderie/client 0.19.0 → 0.21.0
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/brain/signatures.md +6 -0
- package/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/brain/signatures.md
CHANGED
|
@@ -84,6 +84,11 @@ new AuditClient(http: HttpClient, tokens: TokenStore): AuditClient
|
|
|
84
84
|
.setWorkspaceId(workspaceId: string | undefined): void
|
|
85
85
|
.listEvents(input?: IListAuditEventsInput, opts?: IReadOptions | undefined): Promise<IApiResponse<IAuditPageResult>>
|
|
86
86
|
|
|
87
|
+
interface IAppleNativeInput {
|
|
88
|
+
identityToken: string;
|
|
89
|
+
nonce?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
interface IChangePasswordInput {
|
|
88
93
|
currentPassword: string;
|
|
89
94
|
newPassword: string;
|
|
@@ -139,6 +144,7 @@ new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
|
|
|
139
144
|
.setAccessToken(token: string | undefined): void
|
|
140
145
|
.register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>
|
|
141
146
|
.login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>
|
|
147
|
+
.appleNative(input: IAppleNativeInput): Promise<IApiResponse<ILoginResult>>
|
|
142
148
|
.refreshTokens(refreshToken?: string | undefined): Promise<IApiResponse<IRefreshResult>>
|
|
143
149
|
.forgotPassword(email: string): Promise<IApiResponse<undefined>>
|
|
144
150
|
.resetPassword(input: IResetPasswordInput): Promise<IApiResponse<undefined>>
|
package/dist/index.cjs
CHANGED
|
@@ -90,10 +90,14 @@ var FonderieApiError = class extends Error {
|
|
|
90
90
|
details;
|
|
91
91
|
requestId;
|
|
92
92
|
};
|
|
93
|
-
function
|
|
93
|
+
function randHex(bytes) {
|
|
94
94
|
const c = globalThis.crypto;
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
const arr = new Uint8Array(bytes);
|
|
96
|
+
if (c?.getRandomValues) c.getRandomValues(arr);
|
|
97
|
+
else for (let i = 0; i < bytes; i++) arr[i] = Math.floor(Math.random() * 256);
|
|
98
|
+
let out = "";
|
|
99
|
+
for (const b of arr) out += b.toString(16).padStart(2, "0");
|
|
100
|
+
return out;
|
|
97
101
|
}
|
|
98
102
|
var HttpClient = class {
|
|
99
103
|
constructor(baseUrl, deps = {}) {
|
|
@@ -142,9 +146,11 @@ var HttpClient = class {
|
|
|
142
146
|
return data;
|
|
143
147
|
}
|
|
144
148
|
async exec(opts, retried = false) {
|
|
145
|
-
const
|
|
149
|
+
const traceId = randHex(16);
|
|
150
|
+
const requestId = traceId;
|
|
146
151
|
const headers = {
|
|
147
152
|
"Content-Type": "application/json",
|
|
153
|
+
traceparent: `00-${traceId}-${randHex(8)}-01`,
|
|
148
154
|
"X-Request-ID": requestId
|
|
149
155
|
};
|
|
150
156
|
if (opts.token) headers["Authorization"] = `Bearer ${opts.token}`;
|
|
@@ -288,6 +294,16 @@ var AuthClient = class {
|
|
|
288
294
|
body: input
|
|
289
295
|
});
|
|
290
296
|
}
|
|
297
|
+
// Complete a native Sign in with Apple. Returns the same token/user envelope
|
|
298
|
+
// as login (no MFA branch — OAuth completions don't gate on MFA). Requires
|
|
299
|
+
// the API to enable the provider (`providers: ['apple']` + apple config).
|
|
300
|
+
appleNative(input) {
|
|
301
|
+
return this.http.request({
|
|
302
|
+
method: "POST",
|
|
303
|
+
path: "/auth/apple/native",
|
|
304
|
+
body: input
|
|
305
|
+
});
|
|
306
|
+
}
|
|
291
307
|
refreshTokens(refreshToken) {
|
|
292
308
|
return this.http.request({
|
|
293
309
|
method: "POST",
|