@zyphr-dev/node-sdk 0.1.12 → 0.1.16
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 +10 -3
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +31 -0
package/dist/index.d.cts
CHANGED
|
@@ -22505,7 +22505,27 @@ declare class Zyphr {
|
|
|
22505
22505
|
readonly profile: AuthUserProfileApi;
|
|
22506
22506
|
readonly webauthn: AuthWebAuthnApi;
|
|
22507
22507
|
};
|
|
22508
|
+
private readonly options;
|
|
22508
22509
|
constructor(options: ZyphrOptions);
|
|
22510
|
+
/**
|
|
22511
|
+
* Create request overrides that authenticate as an end user.
|
|
22512
|
+
* Use this when calling profile, session, or MFA endpoints that
|
|
22513
|
+
* require the end user's access token instead of the API key.
|
|
22514
|
+
*
|
|
22515
|
+
* Includes both the end-user Bearer token and the application
|
|
22516
|
+
* public key (X-Application-Key) required by user-scoped endpoints.
|
|
22517
|
+
*
|
|
22518
|
+
* @example
|
|
22519
|
+
* ```ts
|
|
22520
|
+
* const login = await zyphr.auth.login.loginEndUser({ ... });
|
|
22521
|
+
* const token = login.data.tokens.access_token;
|
|
22522
|
+
*
|
|
22523
|
+
* const profile = await zyphr.auth.profile.getEndUser(
|
|
22524
|
+
* zyphr.asEndUser(token)
|
|
22525
|
+
* );
|
|
22526
|
+
* ```
|
|
22527
|
+
*/
|
|
22528
|
+
asEndUser(accessToken: string): RequestInit;
|
|
22509
22529
|
}
|
|
22510
22530
|
|
|
22511
22531
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -22505,7 +22505,27 @@ declare class Zyphr {
|
|
|
22505
22505
|
readonly profile: AuthUserProfileApi;
|
|
22506
22506
|
readonly webauthn: AuthWebAuthnApi;
|
|
22507
22507
|
};
|
|
22508
|
+
private readonly options;
|
|
22508
22509
|
constructor(options: ZyphrOptions);
|
|
22510
|
+
/**
|
|
22511
|
+
* Create request overrides that authenticate as an end user.
|
|
22512
|
+
* Use this when calling profile, session, or MFA endpoints that
|
|
22513
|
+
* require the end user's access token instead of the API key.
|
|
22514
|
+
*
|
|
22515
|
+
* Includes both the end-user Bearer token and the application
|
|
22516
|
+
* public key (X-Application-Key) required by user-scoped endpoints.
|
|
22517
|
+
*
|
|
22518
|
+
* @example
|
|
22519
|
+
* ```ts
|
|
22520
|
+
* const login = await zyphr.auth.login.loginEndUser({ ... });
|
|
22521
|
+
* const token = login.data.tokens.access_token;
|
|
22522
|
+
*
|
|
22523
|
+
* const profile = await zyphr.auth.profile.getEndUser(
|
|
22524
|
+
* zyphr.asEndUser(token)
|
|
22525
|
+
* );
|
|
22526
|
+
* ```
|
|
22527
|
+
*/
|
|
22528
|
+
asEndUser(accessToken: string): RequestInit;
|
|
22509
22529
|
}
|
|
22510
22530
|
|
|
22511
22531
|
/**
|
package/dist/index.js
CHANGED
|
@@ -17878,7 +17878,9 @@ var Zyphr = class {
|
|
|
17878
17878
|
devices;
|
|
17879
17879
|
waas;
|
|
17880
17880
|
auth;
|
|
17881
|
+
options;
|
|
17881
17882
|
constructor(options) {
|
|
17883
|
+
this.options = options;
|
|
17882
17884
|
const config = new Configuration({
|
|
17883
17885
|
basePath: options.baseUrl,
|
|
17884
17886
|
apiKey: (name) => {
|
|
@@ -17919,6 +17921,33 @@ var Zyphr = class {
|
|
|
17919
17921
|
webauthn: new AuthWebAuthnApi(config)
|
|
17920
17922
|
};
|
|
17921
17923
|
}
|
|
17924
|
+
/**
|
|
17925
|
+
* Create request overrides that authenticate as an end user.
|
|
17926
|
+
* Use this when calling profile, session, or MFA endpoints that
|
|
17927
|
+
* require the end user's access token instead of the API key.
|
|
17928
|
+
*
|
|
17929
|
+
* Includes both the end-user Bearer token and the application
|
|
17930
|
+
* public key (X-Application-Key) required by user-scoped endpoints.
|
|
17931
|
+
*
|
|
17932
|
+
* @example
|
|
17933
|
+
* ```ts
|
|
17934
|
+
* const login = await zyphr.auth.login.loginEndUser({ ... });
|
|
17935
|
+
* const token = login.data.tokens.access_token;
|
|
17936
|
+
*
|
|
17937
|
+
* const profile = await zyphr.auth.profile.getEndUser(
|
|
17938
|
+
* zyphr.asEndUser(token)
|
|
17939
|
+
* );
|
|
17940
|
+
* ```
|
|
17941
|
+
*/
|
|
17942
|
+
asEndUser(accessToken) {
|
|
17943
|
+
const headers = {
|
|
17944
|
+
Authorization: `Bearer ${accessToken}`
|
|
17945
|
+
};
|
|
17946
|
+
if (this.options.applicationKey) {
|
|
17947
|
+
headers["X-Application-Key"] = this.options.applicationKey;
|
|
17948
|
+
}
|
|
17949
|
+
return { headers };
|
|
17950
|
+
}
|
|
17922
17951
|
};
|
|
17923
17952
|
|
|
17924
17953
|
// src/index.ts
|