Skip to content

Commit

Permalink
fix compat with latest version of nu
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart committed Nov 3, 2024
1 parent 8cbecc4 commit a2f2a95
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions nushell/config.nu
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ $env.config = {
keycode: backspace,
mode: [emacs, vi_insert],
event: { edit: backspaceword }

}
}
]
}
9 changes: 6 additions & 3 deletions nushell/env.nu
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Nushell Environment Config File

open ~/.config/nu.env.toml | get env | load-env
try {
open ~/.config/nu.env.toml | get env | load-env
} catch {}

def starship_prompt [short_prompt = false] {
let dur = $env.CMD_DURATION_MS;
Expand Down Expand Up @@ -43,8 +45,9 @@ $env.PATH = ($env.PATH | prepend $"($env.HOME)/.rd/bin")
$env.PATH = ($env.PATH | prepend $"($env.HOME)/.volta/bin")
$env.PATH = ($env.PATH | prepend $"/usr/local/opt/kubernetes-cli@1.22/bin")


$env.HOMEBREW_GITHUB_API_TOKEN = $env.GITHUB_TOKEN
if ('GITHUB_TOKEN' in $env) {
$env.HOMEBREW_GITHUB_API_TOKEN = $env.GITHUB_TOKEN
}

# Specifies how environment variables are:
# - converted from a string to a value on Nushell startup (from_string)
Expand Down
8 changes: 4 additions & 4 deletions nushell/scripts/jwt_utils.nu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std assert
use ./utils.nu default_value

export def jwt [token?: string] {
def b64_to_record [] { $in | decode new-base64 --nopad | decode | from json; }
def b64_to_record [] { $in | decode base64 --nopad | decode | from json; }

let token = default_value $token $in
let parts = $token | split row "."
Expand Down Expand Up @@ -47,11 +47,11 @@ export def verify_signature [token: string, jwks?: string] {
let signer = $key | select e kty n
print $signer.n

let n = $signer.n | decode new-base64 --nopad --url | encode hex
let e = $signer.e | decode new-base64 --nopad --url | encode hex
let n = $signer.n | decode base64 --nopad --url | encode hex
let e = $signer.e | decode base64 --nopad --url | encode hex


let len = ($n | str length)

print { len: $len, signer_n: $signer.n, enc_n: ($signer.n | encode new-base64), signer_e: $signer.e, n: $n, e: $e, hash: $hash, sig: $parts.2 } | to json
print { len: $len, signer_n: $signer.n, enc_n: ($signer.n | encode base64), signer_e: $signer.e, n: $n, e: $e, hash: $hash, sig: $parts.2 } | to json
}

0 comments on commit a2f2a95

Please sign in to comment.