Skip to content

Commit 7bdd4b6

Browse files
committed
fix(payments): strip wallet-auth: prefix from StripePrivy private key
AWS docs (https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/payments-prerequisites.html) ship the StripePrivy authorization-private-key with a 'wallet-auth:' prefix. The CLI's base64 validator rejected this with a misleading error message. Strip the prefix transparently in both CLI and TUI so users can paste the key straight from the docs.
1 parent f296c2c commit 7bdd4b6

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/cli/primitives/PaymentConnectorPrimitive.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,12 @@ export class PaymentConnectorPrimitive extends BasePrimitive<AddPaymentConnector
415415

416416
// Validate StripePrivy authorizationPrivateKey format (base64-encoded EC P-256 key)
417417
if (provider === 'StripePrivy') {
418-
const trimmedKey = cliOptions.authorizationPrivateKey!.trim();
418+
// AWS docs ship the key with a `wallet-auth:` prefix — strip it transparently.
419+
let trimmedKey = cliOptions.authorizationPrivateKey!.trim();
420+
if (trimmedKey.startsWith('wallet-auth:')) {
421+
trimmedKey = trimmedKey.slice('wallet-auth:'.length);
422+
cliOptions.authorizationPrivateKey = trimmedKey;
423+
}
419424
const BASE64_REGEX = /^[A-Za-z0-9+/]+=*$/;
420425
if (!BASE64_REGEX.test(trimmedKey)) {
421426
const error = 'authorizationPrivateKey must be base64-encoded';

src/cli/tui/screens/payment/useAddPaymentWizard.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ export function useAddPaymentConnectorWizard(preSelectedManager?: string) {
296296

297297
const setAuthorizationPrivateKey = useCallback(
298298
(authorizationPrivateKey: string) => {
299-
setConfig(c => ({ ...c, authorizationPrivateKey }));
299+
// AWS docs ship the key with a `wallet-auth:` prefix — strip it transparently.
300+
const cleaned = authorizationPrivateKey.startsWith('wallet-auth:')
301+
? authorizationPrivateKey.slice('wallet-auth:'.length)
302+
: authorizationPrivateKey;
303+
setConfig(c => ({ ...c, authorizationPrivateKey: cleaned }));
300304
advanceFrom('authorization-private-key');
301305
},
302306
[advanceFrom]

0 commit comments

Comments
 (0)