Skip to content

Commit 1d2bd03

Browse files
feat: make expressip macaroon caveat optional
TICKET: BTC-1846
1 parent 7c1662d commit 1d2bd03

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

modules/express/src/lightning/codecs.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,19 @@ export const GetWalletStateResponse = t.type(
3333

3434
export type GetWalletStateResponse = t.TypeOf<typeof GetWalletStateResponse>;
3535

36-
export const InitLightningWalletRequest = t.strict(
37-
{
38-
walletId: t.string,
39-
passphrase: t.string,
40-
signerIP: IPAddress,
41-
signerTlsCert: t.string,
42-
signerTlsKey: t.string,
43-
expressIP: IPAddress,
44-
},
45-
'InitLightningWalletRequest'
46-
);
36+
export const InitLightningWalletRequest = t.intersection([
37+
t.strict(
38+
{
39+
walletId: t.string,
40+
passphrase: t.string,
41+
signerIP: IPAddress,
42+
signerTlsCert: t.string,
43+
signerTlsKey: t.string,
44+
},
45+
'InitLightningWalletRequest'
46+
),
47+
t.partial({ expressIP: IPAddress }),
48+
]);
4749

4850
export type InitLightningWalletRequest = t.TypeOf<typeof InitLightningWalletRequest>;
4951

modules/express/src/lightning/lightningSignerRoutes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export async function handleInitLightningWallet(req: express.Request): Promise<u
9494

9595
const encryptedSignerAdminMacaroon = bitgo.encrypt({
9696
password: passphrase,
97-
input: addIPCaveatToMacaroon(adminMacaroon, expressIP),
97+
input: expressIP ? addIPCaveatToMacaroon(adminMacaroon, expressIP) : adminMacaroon,
9898
});
9999
const encryptedSignerTlsKey = bitgo.encrypt({ password: passphrase, input: signerTlsKey });
100100
const watchOnly = createWatchOnly(signerRootKey, network);

0 commit comments

Comments
 (0)