File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
packages/thirdweb/src/client Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ when explicitly passing ` clientId ` to ` createThirdwebClient() ` prefer it over computing the ` clientId ` from a passed ` secretKey ` option
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ describe("client", () => {
1313 expect ( client . clientId ) . toBe ( computeClientIdFromSecretKey ( "bar" ) ) ;
1414 expect ( client . secretKey ) . toBe ( "bar" ) ;
1515 } ) ;
16- it ( "should ignore clientId if secretKey is provided" , ( ) => {
16+ it ( "should NOT ignore clientId if secretKey is provided" , ( ) => {
1717 const client = createThirdwebClient ( { clientId : "foo" , secretKey : "bar" } ) ;
18- expect ( client . clientId ) . toBe ( computeClientIdFromSecretKey ( "bar" ) ) ;
18+ expect ( client . clientId ) . toBe ( "foo" ) ;
1919 expect ( client . secretKey ) . toBe ( "bar" ) ;
2020 } ) ;
2121 it ( "should throw an error if neither clientId nor secretKey is provided" , ( ) => {
Original file line number Diff line number Diff line change @@ -114,7 +114,8 @@ export function createThirdwebClient(
114114 throw new Error ( "clientId must be provided when using a JWT secretKey" ) ;
115115 }
116116 } else {
117- realClientId = computeClientIdFromSecretKey ( secretKey ) ;
117+ // always PREFER the clientId if provided, only compute it from the secretKey if we don't have a clientId passed explicitly
118+ realClientId = clientId ?? computeClientIdFromSecretKey ( secretKey ) ;
118119 }
119120 }
120121
You can’t perform that action at this time.
0 commit comments