@zerodev/wallet-core 0.0.1-alpha.7 → 0.0.1-alpha.9

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 CHANGED
@@ -87,7 +87,7 @@ await wallet.auth({
87
87
 
88
88
  ```typescript
89
89
  // Send magic link
90
- await wallet.auth({
90
+ const { otpId } = await wallet.auth({
91
91
  type: "otp",
92
92
  mode: "sendOtp",
93
93
  email: "user@example.com",
@@ -103,7 +103,6 @@ await wallet.auth({
103
103
  mode: "verifyOtp",
104
104
  otpId,
105
105
  otpCode: otp, // OTP from magic link url
106
- subOrganizationId,
107
106
  });
108
107
  ```
109
108
 
@@ -111,7 +110,7 @@ await wallet.auth({
111
110
 
112
111
  ```typescript
113
112
  // Step 1: Send OTP code
114
- const data = await wallet.auth({
113
+ const { otpId } = await wallet.auth({
115
114
  type: 'otp',
116
115
  mode: 'sendOtp',
117
116
  email: 'user@example.com',
@@ -122,20 +121,18 @@ const data = await wallet.auth({
122
121
  await wallet.auth({
123
122
  type: 'otp',
124
123
  mode: 'verifyOtp',
125
- otpId: data.otpId,
124
+ otpId,
126
125
  otpCode: '123456',
127
- subOrganizationId: data.subOrganizationId
128
126
  });
129
127
  ```
130
128
 
131
129
  ### OAuth (Google)
132
130
 
133
131
  ```typescript
134
- // After getting credential from Google OAuth
132
+ // Backend handles PKCE and token exchange - no client-side OAuth library needed
135
133
  await wallet.auth({
136
134
  type: 'oauth',
137
- provider: 'google',
138
- credential: googleCredential // JWT from Google
135
+ provider: 'google'
139
136
  });
140
137
  ```
141
138
 
@@ -2,14 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUserEmail = getUserEmail;
4
4
  async function getUserEmail(client, params) {
5
- const { organizationId, projectId } = params;
5
+ const { organizationId, projectId, token } = params;
6
6
  return await client.request({
7
7
  path: `${projectId}/user-email`,
8
8
  method: 'POST',
9
9
  body: {
10
10
  organizationId,
11
11
  },
12
+ headers: {
13
+ Authorization: `Bearer ${token}`,
14
+ },
12
15
  stamp: true,
16
+ stampPostion: 'headers',
13
17
  });
14
18
  }
15
19
  //# sourceMappingURL=getUserEmail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUserEmail.js","sourceRoot":"","sources":["../../../../src/actions/auth/getUserEmail.ts"],"names":[],"mappings":";;AA8BA,oCAcC;AAdM,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,MAA8B;IAE9B,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,MAAM,CAAA;IAE5C,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,IAAI,EAAE,GAAG,SAAS,aAAa;QAC/B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,cAAc;SACf;QACD,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;AACJ,CAAC"}
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"}
@@ -9,20 +9,25 @@
9
9
  * ```ts
10
10
  * const userEmail = await getUserEmail(client, {
11
11
  * organizationId: 'org_123',
12
- * projectId: 'proj_456'
12
+ * projectId: 'proj_456',
13
+ * token: 'session_token_abc',
13
14
  * });
14
15
  * console.log(userEmail.email); // 'user@example.com'
15
16
  * ```
16
17
  */
17
18
  export async function getUserEmail(client, params) {
18
- const { organizationId, projectId } = params;
19
+ const { organizationId, projectId, token } = params;
19
20
  return await client.request({
20
21
  path: `${projectId}/user-email`,
21
22
  method: 'POST',
22
23
  body: {
23
24
  organizationId,
24
25
  },
26
+ headers: {
27
+ Authorization: `Bearer ${token}`,
28
+ },
25
29
  stamp: true,
30
+ stampPostion: 'headers',
26
31
  });
27
32
  }
28
33
  //# sourceMappingURL=getUserEmail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUserEmail.js","sourceRoot":"","sources":["../../../../src/actions/auth/getUserEmail.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,MAA8B;IAE9B,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,MAAM,CAAA;IAE5C,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,IAAI,EAAE,GAAG,SAAS,aAAa;QAC/B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,cAAc;SACf;QACD,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;AACJ,CAAC"}
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"}
@@ -4,6 +4,8 @@ export type GetUserEmailParameters = {
4
4
  organizationId: string;
5
5
  /** The project ID for the request */
6
6
  projectId: string;
7
+ /** The session token for authorization */
8
+ token: string;
7
9
  };
8
10
  export type GetUserEmailReturnType = {
9
11
  /** The user's email address */
@@ -20,7 +22,8 @@ export type GetUserEmailReturnType = {
20
22
  * ```ts
21
23
  * const userEmail = await getUserEmail(client, {
22
24
  * organizationId: 'org_123',
23
- * projectId: 'proj_456'
25
+ * projectId: 'proj_456',
26
+ * token: 'session_token_abc',
24
27
  * });
25
28
  * console.log(userEmail.email); // 'user@example.com'
26
29
  * ```
@@ -1 +1 @@
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;CAClB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAWjC"}
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"}