File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,28 @@ export async function getGcpKmsAccount(
4040) : Promise < GcpKmsAccount > {
4141 const { name : unprocessedName , clientOptions, client } = options ;
4242
43+ let rawPrivateKey : string | undefined ;
44+ if ( clientOptions ?. credentials ) {
45+ if ( "private_key" in clientOptions . credentials ) {
46+ rawPrivateKey = clientOptions . credentials . private_key ;
47+ }
48+ }
49+
4350 // we had a bug previously where we previously called it "cryptoKeyVersion" instead of "cryptoKeyVersions"
4451 // if we detect that, we'll fix it here
4552 // TODO: remove this as a breaking change
4653 const name = unprocessedName . includes ( "cryptoKeyVersions" )
4754 ? unprocessedName
4855 : unprocessedName . replace ( "cryptoKeyVersion" , "cryptoKeyVersions" ) ;
4956
50- const signer = new CloudKmsSigner ( name , clientOptions ) ;
57+ const signer = new CloudKmsSigner ( name , {
58+ ...clientOptions ,
59+ credentials : {
60+ ...clientOptions ?. credentials ,
61+ // https://stackoverflow.com/questions/74131595/error-error1e08010cdecoder-routinesunsupported-with-google-auth-library
62+ private_key : rawPrivateKey ?. split ( String . raw `\n` ) . join ( "\n" ) ,
63+ } ,
64+ } ) ;
5165
5266 // Populate address immediately
5367 const publicKey = await signer . getPublicKey ( ) ;
Original file line number Diff line number Diff line change @@ -126,7 +126,10 @@ export const getAccount = async (args: {
126126 clientOptions : {
127127 credentials : {
128128 client_email : gcpApplicationCredentialEmail ,
129- private_key : gcpApplicationCredentialPrivateKey ,
129+ // https://stackoverflow.com/questions/74131595/error-error1e08010cdecoder-routinesunsupported-with-google-auth-library
130+ private_key : gcpApplicationCredentialPrivateKey
131+ . split ( String . raw `\n` )
132+ . join ( "\n" ) ,
130133 } ,
131134 } ,
132135 } ) ;
You can’t perform that action at this time.
0 commit comments