@zerodev/wallet-core 0.0.1-alpha.15 → 0.0.1-alpha.17
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/dist/_cjs/actions/auth/{getUserEmail.js → getAuthenticators.js} +6 -6
- package/dist/_cjs/actions/auth/getAuthenticators.js.map +1 -0
- package/dist/_cjs/actions/auth/index.js +3 -3
- package/dist/_cjs/actions/auth/index.js.map +1 -1
- package/dist/_cjs/actions/index.js +2 -2
- package/dist/_cjs/actions/index.js.map +1 -1
- package/dist/_cjs/client/decorators/client.js +1 -1
- package/dist/_cjs/client/decorators/client.js.map +1 -1
- package/dist/_cjs/index.js +2 -1
- package/dist/_cjs/index.js.map +1 -1
- package/dist/_esm/actions/auth/getAuthenticators.js +36 -0
- package/dist/_esm/actions/auth/getAuthenticators.js.map +1 -0
- package/dist/_esm/actions/auth/index.js +1 -1
- package/dist/_esm/actions/auth/index.js.map +1 -1
- package/dist/_esm/actions/index.js +1 -1
- package/dist/_esm/actions/index.js.map +1 -1
- package/dist/_esm/client/decorators/client.js +2 -2
- package/dist/_esm/client/decorators/client.js.map +1 -1
- package/dist/_esm/index.js +1 -1
- package/dist/_esm/index.js.map +1 -1
- package/dist/_types/actions/auth/getAuthenticators.d.ts +65 -0
- package/dist/_types/actions/auth/getAuthenticators.d.ts.map +1 -0
- package/dist/_types/actions/auth/index.d.ts +1 -1
- package/dist/_types/actions/auth/index.d.ts.map +1 -1
- package/dist/_types/actions/index.d.ts +1 -1
- package/dist/_types/actions/index.d.ts.map +1 -1
- package/dist/_types/client/decorators/client.d.ts +4 -3
- package/dist/_types/client/decorators/client.d.ts.map +1 -1
- package/dist/_types/index.d.ts +2 -2
- package/dist/_types/index.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/actions/auth/getAuthenticators.ts +89 -0
- package/src/actions/auth/index.ts +9 -5
- package/src/actions/index.ts +7 -3
- package/src/client/decorators/client.ts +9 -8
- package/src/index.ts +7 -0
- package/dist/_cjs/actions/auth/getUserEmail.js.map +0 -1
- package/dist/_esm/actions/auth/getUserEmail.js +0 -33
- package/dist/_esm/actions/auth/getUserEmail.js.map +0 -1
- package/dist/_types/actions/auth/getUserEmail.d.ts +0 -32
- package/dist/_types/actions/auth/getUserEmail.d.ts.map +0 -1
- package/src/actions/auth/getUserEmail.ts +0 -52
package/package.json
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type GetAuthenticatorsParameters = {
|
|
4
|
+
/** The sub-organization ID to query authenticators for */
|
|
5
|
+
subOrganizationId: string
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string
|
|
8
|
+
/** The session token for authorization */
|
|
9
|
+
token: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** An OAuth authenticator linked to the user */
|
|
13
|
+
export type OAuthAuthenticator = {
|
|
14
|
+
provider?: string
|
|
15
|
+
clientId?: string
|
|
16
|
+
subject?: string
|
|
17
|
+
[key: string]: unknown
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A passkey (WebAuthn) authenticator */
|
|
21
|
+
export type PasskeyAuthenticator = {
|
|
22
|
+
rpId?: string
|
|
23
|
+
publicKey?: string
|
|
24
|
+
credentialId?: string
|
|
25
|
+
[key: string]: unknown
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** An email contact linked to the user */
|
|
29
|
+
export type EmailContact = {
|
|
30
|
+
email?: string
|
|
31
|
+
[key: string]: unknown
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** An API key authenticator */
|
|
35
|
+
export type ApiKeyAuthenticator = {
|
|
36
|
+
apiKey?: string
|
|
37
|
+
[key: string]: unknown
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type GetAuthenticatorsReturnType = {
|
|
41
|
+
/** OAuth providers linked to the user (null if none) */
|
|
42
|
+
oauths: OAuthAuthenticator[] | null
|
|
43
|
+
/** Passkey authenticators registered for the user (null if none) */
|
|
44
|
+
passkeys: PasskeyAuthenticator[] | null
|
|
45
|
+
/** Email contacts associated with the user (null if none) */
|
|
46
|
+
emailContacts: EmailContact[] | null
|
|
47
|
+
/** API keys associated with the user (null if none) */
|
|
48
|
+
apiKeys: ApiKeyAuthenticator[] | null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Fetches all authenticators (oauths, passkeys, emailContacts, apiKeys) for
|
|
53
|
+
* the authenticated user within the given project/sub-organization.
|
|
54
|
+
*
|
|
55
|
+
* Corresponds to `POST /api/v1/{projectId}/authenticators`.
|
|
56
|
+
*
|
|
57
|
+
* @param client - The ZeroDev Wallet client
|
|
58
|
+
* @param params - The parameters for the authenticators request
|
|
59
|
+
* @returns The user's authenticators grouped by type
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const authenticators = await getAuthenticators(client, {
|
|
64
|
+
* subOrganizationId: 'suborg_123',
|
|
65
|
+
* projectId: 'proj_456',
|
|
66
|
+
* token: 'session_token_abc',
|
|
67
|
+
* });
|
|
68
|
+
* console.log(authenticators.oauths, authenticators.passkeys);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export async function getAuthenticators(
|
|
72
|
+
client: Client,
|
|
73
|
+
params: GetAuthenticatorsParameters,
|
|
74
|
+
): Promise<GetAuthenticatorsReturnType> {
|
|
75
|
+
const { subOrganizationId, projectId, token } = params
|
|
76
|
+
|
|
77
|
+
return await client.request({
|
|
78
|
+
path: `${projectId}/authenticators`,
|
|
79
|
+
method: 'POST',
|
|
80
|
+
body: {
|
|
81
|
+
subOrganizationId,
|
|
82
|
+
},
|
|
83
|
+
headers: {
|
|
84
|
+
Authorization: `Bearer ${token}`,
|
|
85
|
+
},
|
|
86
|
+
stamp: true,
|
|
87
|
+
stampPostion: 'headers',
|
|
88
|
+
})
|
|
89
|
+
}
|
|
@@ -10,15 +10,19 @@ export {
|
|
|
10
10
|
type AuthenticateWithOAuthReturnType,
|
|
11
11
|
authenticateWithOAuth,
|
|
12
12
|
} from './authenticateWithOAuth.js'
|
|
13
|
+
export {
|
|
14
|
+
type ApiKeyAuthenticator,
|
|
15
|
+
type EmailContact,
|
|
16
|
+
type GetAuthenticatorsParameters,
|
|
17
|
+
type GetAuthenticatorsReturnType,
|
|
18
|
+
getAuthenticators,
|
|
19
|
+
type OAuthAuthenticator,
|
|
20
|
+
type PasskeyAuthenticator,
|
|
21
|
+
} from './getAuthenticators.js'
|
|
13
22
|
export {
|
|
14
23
|
type GetAuthProxyConfigIdReturnType,
|
|
15
24
|
getAuthProxyConfigId,
|
|
16
25
|
} from './getAuthProxyConfigId.js'
|
|
17
|
-
export {
|
|
18
|
-
type GetUserEmailParameters,
|
|
19
|
-
type GetUserEmailReturnType,
|
|
20
|
-
getUserEmail,
|
|
21
|
-
} from './getUserEmail.js'
|
|
22
26
|
export {
|
|
23
27
|
type GetWhoamiParameters,
|
|
24
28
|
type GetWhoamiReturnType,
|
package/src/actions/index.ts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
// Auth actions
|
|
2
2
|
export {
|
|
3
|
+
type ApiKeyAuthenticator,
|
|
3
4
|
type AuthenticateWithEmailParameters,
|
|
4
5
|
type AuthenticateWithEmailReturnType,
|
|
5
6
|
type AuthenticateWithOAuthParameters,
|
|
6
7
|
type AuthenticateWithOAuthReturnType,
|
|
7
8
|
authenticateWithEmail,
|
|
8
9
|
authenticateWithOAuth,
|
|
10
|
+
type EmailContact,
|
|
9
11
|
type EmailCustomization,
|
|
12
|
+
type GetAuthenticatorsParameters,
|
|
13
|
+
type GetAuthenticatorsReturnType,
|
|
10
14
|
type GetAuthProxyConfigIdReturnType,
|
|
11
|
-
type GetUserEmailParameters,
|
|
12
|
-
type GetUserEmailReturnType,
|
|
13
15
|
type GetWhoamiParameters,
|
|
14
16
|
type GetWhoamiReturnType,
|
|
17
|
+
getAuthenticators,
|
|
15
18
|
getAuthProxyConfigId,
|
|
16
|
-
getUserEmail,
|
|
17
19
|
getWhoami,
|
|
18
20
|
type LoginWithOTPParameters,
|
|
19
21
|
type LoginWithOTPReturnType,
|
|
20
22
|
loginWithOTP,
|
|
23
|
+
type OAuthAuthenticator,
|
|
21
24
|
type OtpContact,
|
|
25
|
+
type PasskeyAuthenticator,
|
|
22
26
|
type RegisterWithOTPParameters,
|
|
23
27
|
type RegisterWithOTPReturnType,
|
|
24
28
|
type RegisterWithPasskeyParameters,
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
type AuthenticateWithOAuthReturnType,
|
|
11
11
|
authenticateWithEmail,
|
|
12
12
|
authenticateWithOAuth,
|
|
13
|
+
type GetAuthenticatorsParameters,
|
|
14
|
+
type GetAuthenticatorsReturnType,
|
|
13
15
|
type GetAuthProxyConfigIdReturnType,
|
|
14
|
-
type GetUserEmailParameters,
|
|
15
|
-
type GetUserEmailReturnType,
|
|
16
16
|
type GetUserWalletParameters,
|
|
17
17
|
type GetUserWalletReturnType,
|
|
18
18
|
type GetWhoamiParameters,
|
|
19
19
|
type GetWhoamiReturnType,
|
|
20
|
+
getAuthenticators,
|
|
20
21
|
getAuthProxyConfigId,
|
|
21
|
-
getUserEmail,
|
|
22
22
|
getUserWallet,
|
|
23
23
|
getWhoami,
|
|
24
24
|
type LoginWithOTPParameters,
|
|
@@ -73,11 +73,12 @@ export type ZeroDevWalletActions = {
|
|
|
73
73
|
getWhoami: (params: GetWhoamiParameters) => Promise<GetWhoamiReturnType>
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Fetches all authenticators (oauths, passkeys, emailContacts, apiKeys)
|
|
77
|
+
* for the authenticated user within the given project/sub-organization
|
|
77
78
|
*/
|
|
78
|
-
|
|
79
|
-
params:
|
|
80
|
-
) => Promise<
|
|
79
|
+
getAuthenticators: (
|
|
80
|
+
params: GetAuthenticatorsParameters,
|
|
81
|
+
) => Promise<GetAuthenticatorsReturnType>
|
|
81
82
|
|
|
82
83
|
// Wallet actions
|
|
83
84
|
/**
|
|
@@ -182,7 +183,7 @@ export function zeroDevWalletActions(client: Client): ZeroDevWalletActions {
|
|
|
182
183
|
authenticateWithEmail: (params) => authenticateWithEmail(client, params),
|
|
183
184
|
authenticateWithOAuth: (params) => authenticateWithOAuth(client, params),
|
|
184
185
|
getWhoami: (params) => getWhoami(client, params),
|
|
185
|
-
|
|
186
|
+
getAuthenticators: (params) => getAuthenticators(client, params),
|
|
186
187
|
|
|
187
188
|
// Wallet actions
|
|
188
189
|
getUserWallet: (params) => getUserWallet(client, params),
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export type {
|
|
2
2
|
// Auth types
|
|
3
|
+
ApiKeyAuthenticator,
|
|
3
4
|
AuthenticateWithEmailParameters,
|
|
4
5
|
AuthenticateWithEmailReturnType,
|
|
5
6
|
AuthenticateWithOAuthParameters,
|
|
6
7
|
AuthenticateWithOAuthReturnType,
|
|
8
|
+
EmailContact,
|
|
7
9
|
EmailCustomization,
|
|
10
|
+
GetAuthenticatorsParameters,
|
|
11
|
+
GetAuthenticatorsReturnType,
|
|
8
12
|
// Wallet types
|
|
9
13
|
GetUserWalletParameters,
|
|
10
14
|
GetUserWalletReturnType,
|
|
@@ -12,7 +16,9 @@ export type {
|
|
|
12
16
|
GetWhoamiReturnType,
|
|
13
17
|
LoginWithOTPParameters,
|
|
14
18
|
LoginWithOTPReturnType,
|
|
19
|
+
OAuthAuthenticator,
|
|
15
20
|
OtpContact,
|
|
21
|
+
PasskeyAuthenticator,
|
|
16
22
|
RegisterWithOTPParameters,
|
|
17
23
|
RegisterWithOTPReturnType,
|
|
18
24
|
Sign7702AuthorizationParameters,
|
|
@@ -32,6 +38,7 @@ export {
|
|
|
32
38
|
// Auth actions
|
|
33
39
|
authenticateWithEmail,
|
|
34
40
|
authenticateWithOAuth,
|
|
41
|
+
getAuthenticators,
|
|
35
42
|
// Wallet actions
|
|
36
43
|
getUserWallet,
|
|
37
44
|
getWhoami,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUserEmail.js","sourceRoot":"","sources":["../../../../src/actions/auth/getUserEmail.ts"],"names":[],"mappings":";;AAiCA,oCAkBC;AAlBM,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,MAA8B;IAE9B,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAEnD,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,IAAI,EAAE,GAAG,SAAS,aAAa;QAC/B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,cAAc;SACf;QACD,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;QACD,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,SAAS;KACxB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the user's email address
|
|
3
|
-
*
|
|
4
|
-
* @param client - The ZeroDev Wallet client
|
|
5
|
-
* @param params - The parameters for the user email request
|
|
6
|
-
* @returns The user's email address
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const userEmail = await getUserEmail(client, {
|
|
11
|
-
* organizationId: 'org_123',
|
|
12
|
-
* projectId: 'proj_456',
|
|
13
|
-
* token: 'session_token_abc',
|
|
14
|
-
* });
|
|
15
|
-
* console.log(userEmail.email); // 'user@example.com'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export async function getUserEmail(client, params) {
|
|
19
|
-
const { organizationId, projectId, token } = params;
|
|
20
|
-
return await client.request({
|
|
21
|
-
path: `${projectId}/user-email`,
|
|
22
|
-
method: 'POST',
|
|
23
|
-
body: {
|
|
24
|
-
organizationId,
|
|
25
|
-
},
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: `Bearer ${token}`,
|
|
28
|
-
},
|
|
29
|
-
stamp: true,
|
|
30
|
-
stampPostion: 'headers',
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=getUserEmail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUserEmail.js","sourceRoot":"","sources":["../../../../src/actions/auth/getUserEmail.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,MAA8B;IAE9B,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAEnD,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,IAAI,EAAE,GAAG,SAAS,aAAa;QAC/B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,cAAc;SACf;QACD,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;QACD,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,SAAS;KACxB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Client } from '../../client/types.js';
|
|
2
|
-
export type GetUserEmailParameters = {
|
|
3
|
-
/** The organization ID to query */
|
|
4
|
-
organizationId: string;
|
|
5
|
-
/** The project ID for the request */
|
|
6
|
-
projectId: string;
|
|
7
|
-
/** The session token for authorization */
|
|
8
|
-
token: string;
|
|
9
|
-
};
|
|
10
|
-
export type GetUserEmailReturnType = {
|
|
11
|
-
/** The user's email address */
|
|
12
|
-
email: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Gets the user's email address
|
|
16
|
-
*
|
|
17
|
-
* @param client - The ZeroDev Wallet client
|
|
18
|
-
* @param params - The parameters for the user email request
|
|
19
|
-
* @returns The user's email address
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const userEmail = await getUserEmail(client, {
|
|
24
|
-
* organizationId: 'org_123',
|
|
25
|
-
* projectId: 'proj_456',
|
|
26
|
-
* token: 'session_token_abc',
|
|
27
|
-
* });
|
|
28
|
-
* console.log(userEmail.email); // 'user@example.com'
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function getUserEmail(client: Client, params: GetUserEmailParameters): Promise<GetUserEmailReturnType>;
|
|
32
|
-
//# sourceMappingURL=getUserEmail.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUserEmail.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/getUserEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,sBAAsB,GAAG;IACnC,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAejC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Client } from '../../client/types.js'
|
|
2
|
-
|
|
3
|
-
export type GetUserEmailParameters = {
|
|
4
|
-
/** The organization ID to query */
|
|
5
|
-
organizationId: string
|
|
6
|
-
/** The project ID for the request */
|
|
7
|
-
projectId: string
|
|
8
|
-
/** The session token for authorization */
|
|
9
|
-
token: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type GetUserEmailReturnType = {
|
|
13
|
-
/** The user's email address */
|
|
14
|
-
email: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Gets the user's email address
|
|
19
|
-
*
|
|
20
|
-
* @param client - The ZeroDev Wallet client
|
|
21
|
-
* @param params - The parameters for the user email request
|
|
22
|
-
* @returns The user's email address
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const userEmail = await getUserEmail(client, {
|
|
27
|
-
* organizationId: 'org_123',
|
|
28
|
-
* projectId: 'proj_456',
|
|
29
|
-
* token: 'session_token_abc',
|
|
30
|
-
* });
|
|
31
|
-
* console.log(userEmail.email); // 'user@example.com'
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export async function getUserEmail(
|
|
35
|
-
client: Client,
|
|
36
|
-
params: GetUserEmailParameters,
|
|
37
|
-
): Promise<GetUserEmailReturnType> {
|
|
38
|
-
const { organizationId, projectId, token } = params
|
|
39
|
-
|
|
40
|
-
return await client.request({
|
|
41
|
-
path: `${projectId}/user-email`,
|
|
42
|
-
method: 'POST',
|
|
43
|
-
body: {
|
|
44
|
-
organizationId,
|
|
45
|
-
},
|
|
46
|
-
headers: {
|
|
47
|
-
Authorization: `Bearer ${token}`,
|
|
48
|
-
},
|
|
49
|
-
stamp: true,
|
|
50
|
-
stampPostion: 'headers',
|
|
51
|
-
})
|
|
52
|
-
}
|