mppx 0.22.0 → 0.22.2

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli/account.d.ts +2 -1
  3. package/dist/cli/account.js +22 -11
  4. package/dist/cli/cli.js +18 -18
  5. package/dist/cli/plugins/index.js +12 -12
  6. package/dist/extensions/identity/attestation/client/index.js +1 -0
  7. package/dist/extensions/identity/attestation/server/index.js +1 -0
  8. package/dist/extensions/identity/email-otp/server/index.js +1 -0
  9. package/dist/extensions/identity/erc8004/client/index.js +1 -0
  10. package/dist/extensions/identity/erc8004/server/index.js +3 -1
  11. package/dist/extensions/identity/link/server/index.js +1 -0
  12. package/dist/extensions/identity/poppy/server/index.js +1 -0
  13. package/dist/extensions/identity/tempo/client/index.js +1 -0
  14. package/dist/extensions/identity/tempo/server/index.js +7 -1
  15. package/dist/extensions/identity/world/server/index.js +1 -0
  16. package/dist/identity/Headers.d.ts +3 -2
  17. package/dist/identity/Headers.js +3 -2
  18. package/dist/identity/Server.d.ts +8 -0
  19. package/dist/identity/Server.js +18 -0
  20. package/dist/identity/Types.d.ts +16 -2
  21. package/dist/internal/version.d.ts +2 -2
  22. package/dist/internal/version.js +1 -1
  23. package/dist/proxy/Proxy.js +59 -46
  24. package/dist/proxy/internal/Headers.d.ts +9 -2
  25. package/dist/proxy/internal/Headers.js +16 -3
  26. package/dist/server/Mppx.d.ts +2 -0
  27. package/dist/server/Mppx.js +1 -0
  28. package/dist/tempo/client/Charge.js +19 -0
  29. package/dist/tempo/server/Charge.d.ts +7 -0
  30. package/dist/tempo/server/Charge.js +100 -12
  31. package/dist/tempo/server/internal/html.gen.js +1 -1
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # mppx
2
2
 
3
+ ## 0.22.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1708661: Aligned Tempo charge push payments (hash credentials) with the spec. The server now rejects them when the signed challenge sets `methodDetails.memo`, requires the attribution memo on the primary transfer rather than on any transfer, and skips other challenges' transfers in a batched transaction instead of rejecting it. Split transfers prefer one carrying this challenge's attribution memo and never count another challenge's. A transfer counted without this challenge's attribution memo, such as a plain split, is accepted only when the transaction pays no other challenge. The client pays a challenge with a server memo in pull mode and refuses an explicit push for it.
8
+
9
+ ## 0.22.1
10
+
11
+ ### Patch Changes
12
+
13
+ - d4a8c29: Added `headers` declarations to every identity extension's verifier, payment check and prover, so a proxy and the client's redirect stripping find each protocol's headers from the extension itself.
14
+ - d20d140: Fixed macOS account storage passing the private key in `security` process arguments. The CLI now sends the keychain command on stdin through `security -i`.
15
+ - e3a3dad: Stripped `Forwarded`, `X-Real-IP`, `True-Client-IP`, `CF-Connecting-IP` and `Via` from proxied requests, as `X-Forwarded-*` already is.
16
+ - 364fe92: Added `headers` to identity verifiers and payment checks: a proxy strips the headers declared by the identity protocols its routes use.
17
+
3
18
  ## 0.22.0
4
19
 
5
20
  ### Minor Changes
@@ -1,4 +1,5 @@
1
- export declare function execCommand(command: string, args: string[]): Promise<{
1
+ /** Runs a command without a shell, optionally writing `input` to its stdin. */
2
+ export declare function execCommand(command: string, args: string[], input?: string): Promise<{
2
3
  stdout: string;
3
4
  stderr: string;
4
5
  error: Error | null;
@@ -26,11 +26,27 @@ function assertSecretToolAvailable(error) {
26
26
  if (error && isMissingCommand(error, 'secret-tool'))
27
27
  throw keyringUnavailableError(error);
28
28
  }
29
- export function execCommand(command, args) {
29
+ /**
30
+ * Formats one command line for `security -i`, which splits stdin lines into arguments with
31
+ * quote and backslash escaping. Rejects newlines, which would end the command line early.
32
+ */
33
+ function securityCommandLine(args) {
34
+ return args
35
+ .map((arg) => {
36
+ if (/[\r\n]/.test(arg))
37
+ throw new Error('Keychain values cannot contain line breaks.');
38
+ return `"${arg.replace(/["\\]/g, '\\$&')}"`;
39
+ })
40
+ .join(' ');
41
+ }
42
+ /** Runs a command without a shell, optionally writing `input` to its stdin. */
43
+ export function execCommand(command, args, input) {
30
44
  return new Promise((resolve) => {
31
- child.execFile(command, args, { timeout: commandTimeoutMs() }, (error, stdout, stderr) => {
45
+ const proc = child.execFile(command, args, { timeout: commandTimeoutMs() }, (error, stdout, stderr) => {
32
46
  resolve({ stdout: stdout.trim(), stderr: stderr.trim(), error });
33
47
  });
48
+ if (input !== undefined)
49
+ proc.stdin?.end(input);
34
50
  });
35
51
  }
36
52
  export function createDefaultStore() {
@@ -133,16 +149,11 @@ export function createKeychain(account = 'main') {
133
149
  async set(value) {
134
150
  const platform = os.platform();
135
151
  if (platform === 'darwin') {
152
+ // Send the command on stdin (`security -i`) so the secret never appears in process arguments.
153
+ // Build it before deleting so a rejected value leaves the existing item in place.
154
+ const input = `${securityCommandLine(['add-generic-password', '-s', service, '-a', account, '-w', value])}\n`;
136
155
  await execCommand('security', ['delete-generic-password', '-s', service, '-a', account]);
137
- const { error } = await execCommand('security', [
138
- 'add-generic-password',
139
- '-s',
140
- service,
141
- '-a',
142
- account,
143
- '-w',
144
- value,
145
- ]);
156
+ const { error } = await execCommand('security', ['-i'], input);
146
157
  if (error)
147
158
  throw error;
148
159
  return;