nickel icon indicating copy to clipboard operation
nickel copied to clipboard

base64 encoding in stdlib

Open gkleen opened this issue 1 year ago • 4 comments

In #1498 I need to base64 encode some values for inclusion into a kubernetes secret.

Currently I'm doing that with the coreutils base64 command at nix eval time.

I would prefer to express the fact that values get base64 encoded directly in the nickel template.
For that a function in std to base64 encode a string would be ideal.

It would be great if the entire space of possibilities (standard charset, urlsafe charset, padded, unpadded) was available for future purposes.

gkleen avatar Sep 29 '23 12:09 gkleen

That's a fair demand and probably cheap to implement. We'd make that a primop relying on a Rust implementation under the hood, for performance reason.

yannham avatar Sep 29 '23 13:09 yannham

By the way, both your feature requests are arguably beginner-friendly. If you would like to try to tackle them by yourself, I would be happy to provide guidance and review.

yannham avatar Oct 02 '23 14:10 yannham

By the way, both your feature requests are arguably beginner-friendly. If you would like to try to tackle them by yourself, I would be happy to provide guidance and review.

I would certainly be open to giving it a shot but it'll be quite some time until I will likely be able to get around to working on it.
The dayjob and freelancing is keeping me quite busy :/

gkleen avatar Oct 04 '23 07:10 gkleen

Unrelated to your request but for what it's worth, Secret has a write-only stringData field that gets merged into data by the API server https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secret-v1-core

silverraven691 avatar Oct 16 '23 10:10 silverraven691