@bowmark/web 1.26.1 → 1.28.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/dist/session.js CHANGED
@@ -41,6 +41,32 @@ const CREDENTIAL_FIELD_SUFFIX = {
41
41
  function isLoginCall(path) {
42
42
  return path.length === 3 && path[0] === "providers" && path[2] === "login";
43
43
  }
44
+ /** `bowmark.providers.<id>.signup(args)` — the other call whose argument carries a
45
+ * credential. Only `password` is one: the email and names are plain values the
46
+ * server reads off the body. */
47
+ function isSignupCall(path) {
48
+ return path.length === 3 && path[0] === "providers" && path[2] === "signup";
49
+ }
50
+ /** Lift `signup()`'s plaintext `password` into a per-request header under the SAME
51
+ * name a later `login()` reads (`<provider>_password`), and put the `SecretRef`
52
+ * placeholder in its place. */
53
+ function liftSignupPassword(providerId, args) {
54
+ const input = args[0];
55
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
56
+ return { args: [...args], headers: {} };
57
+ }
58
+ const password = input.password;
59
+ if (typeof password !== "string")
60
+ return { args: [...args], headers: {} };
61
+ const name = `${providerId}_${CREDENTIAL_FIELD_SUFFIX.password}`;
62
+ return {
63
+ args: [
64
+ { ...input, password: secretRefPlaceholder(name) },
65
+ ...args.slice(1),
66
+ ],
67
+ headers: { [`${CREDENTIAL_HEADER_PREFIX}${name}`]: password },
68
+ };
69
+ }
44
70
  /** The exact shape `bowmark.secret(name)` produces server-side (`SecretRef`,
45
71
  * `@bowmark/schema`) — reconstructed here rather than imported, for the same
46
72
  * reason every other wire shape in this package is a checked copy. */
@@ -190,6 +216,10 @@ function dispatchThrough(send) {
190
216
  const { args: wireArgs, headers } = liftLoginCredentials(providerId, args);
191
217
  return send(path, wireArgs, headers);
192
218
  }
219
+ if (isSignupCall(path)) {
220
+ const { args: wireArgs, headers } = liftSignupPassword(path[1], args);
221
+ return send(path, wireArgs, headers);
222
+ }
193
223
  return send(path, args);
194
224
  };
195
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bowmark/web",
3
- "version": "1.26.1",
3
+ "version": "1.28.0",
4
4
  "type": "module",
5
5
  "description": "The public client for the Bowmark capability library — real TypeScript for the whole bowmark.* surface, with no Bowmark source on the caller's disk. ZERO runtime dependencies, deliberately and permanently.",
6
6
  "license": "MIT",