ionic-team/trapeze

how to use base64 decode?

reslear opened this issue · 1 comments

good afternoon, @mlynch thx for #105 :)
do we have some kind of easy way to decode a base64 string?

for example $GOOGLE_SERVICE_PLIST_RAW it's more convenient to store in base64, but you have to decode it.

I suggest to do it:

  1. automatically value -> base64 === value
  2. or add from key with enumbase64.
platforms:
  ios:
    targets:
      App:
        plist:          
          - file: GoogleService-Info.plist
            xml: $GOOGLE_SERVICE_PLIST_RAW
            # add `from` attribute 
            from: base64

nodejs:

const value = Buffer.from(process.env.GOOGLE_SERVICE_PLIST_RAW, 'base64').toString(
  'ascii'
)

browser:

const value = atob(process.env.GOOGLE_SERVICE_PLIST_RAW)

also my current solution is:

# prebuid.sh

GOOGLE_SERVICE_PLIST_RAW=$(echo $GOOGLE_SERVICE_PLIST_RAW | base64 -d)
pnpm exec trapeze run trapeze-config.yml -y