@calimero-network/mero-js 25.0.3 → 25.0.5

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.
@@ -42,6 +42,7 @@
42
42
  */
43
43
  import { createLocalStorageNonceSource, } from '../relay/index.js';
44
44
  import { signMemberJoinOp, } from '../namespace-op/index.js';
45
+ import { pathSegment } from '../http-client/path-segment.js';
45
46
  /**
46
47
  * Turn an admit refusal into the thing to go and do about it.
47
48
  *
@@ -116,7 +117,7 @@ export async function joinWithNode(input) {
116
117
  // at the typecheck rather than as a 400 from a node.
117
118
  const body = { invitation: input.invitation, signedOp };
118
119
  const url = input.admitUrl ??
119
- `${origin(input.nodeUrl)}/admin-api/namespaces/${input.namespaceId}/admit`;
120
+ `${origin(input.nodeUrl)}/admin-api/namespaces/${pathSegment(input.namespaceId)}/admit`;
120
121
  const doFetch = input.deps?.fetch ?? fetch;
121
122
  let response;
122
123
  try {
@@ -50,6 +50,7 @@
50
50
  * sends the user to the wrong place.
51
51
  */
52
52
  import { CloudClient, } from '../cloud/index.js';
53
+ import { pathSegment } from '../http-client/path-segment.js';
53
54
  /**
54
55
  * Normalise a hex account for comparison: lower-cased, `0x` stripped.
55
56
  *
@@ -166,7 +167,7 @@ export async function resolveRelayFromInvitation(input) {
166
167
  // The cloud's ready-made URL when it gave one, so the path is never rebuilt
167
168
  // from a guess; the fallback is the documented route on the same origin.
168
169
  admitUrl: chosen.admitUrl ??
169
- `${chosen.relayUrl.replace(/\/+$/, '')}/admin-api/namespaces/${input.namespaceId}/admit`,
170
+ `${chosen.relayUrl.replace(/\/+$/, '')}/admin-api/namespaces/${pathSegment(input.namespaceId)}/admit`,
170
171
  admitterAccount: chosen.account,
171
172
  peerId: chosen.peerId,
172
173
  writable: chosen.canExecute,