-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
978e3bf
commit f66b044
Showing
15 changed files
with
195 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
keys: | ||
- &user_violet age14znucymclds0v2sqagnz9m6ptemq9uhqrdr5gtjqzhemu2kdn9rsxcq0ep | ||
- &admin_violet age14znucymclds0v2sqagnz9m6ptemq9uhqrdr5gtjqzhemu2kdn9rsxcq0ep | ||
- &host_liella age17l7dkuhs6y8zqahemjqq4hcrqupd028lelhd437m4m9f7ld3xg2qqm93rs | ||
- &host_quartz age1fnm9yafdq8lfmqxgwh5qn282ukmdxuyxzljdsurqvcgeug22kdrshnpuns | ||
- &host_aqours age10katlmf70gx4knt5w6w6z6a0ary74gfxnvuydq9gpd3mlvrhx35sr2csyr | ||
- &host_marchenstar age12drezrcjc0xnkzd9mmr6wprdwv4r6fpw9nmtqfzxhtzcaxhdz9pqg98c4c | ||
- &user_violet age1wsyj3cgxa94fgcm8ylrkkan4py9e8pxh69t4q7aj45h6y9w98dzqr38hmy | ||
creation_rules: | ||
- path_regex: secrets/common\.yaml$ | ||
key_groups: | ||
- age: | ||
- *user_violet | ||
- *admin_violet | ||
- *host_liella | ||
- *host_quartz | ||
- *host_aqours | ||
- *host_marchenstar | ||
- path_regex: secrets/marchenstar\.yaml$ | ||
- path_regex: secrets/violet\.yaml$ | ||
key_groups: | ||
- age: | ||
- *admin_violet | ||
- *user_violet | ||
- path_regex: secrets/marchenstar\.yaml$ | ||
key_groups: | ||
- age: | ||
- *admin_violet | ||
- *host_marchenstar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let fish_completer = {|spans| | ||
fish --command $'complete "--do-complete=($spans | str join " ")"' | ||
| from tsv --flexible --noheaders --no-infer | ||
| rename value description | ||
} | ||
$env.config = { | ||
completions: { | ||
algorithm: "fuzzy" | ||
external: { | ||
enable: true | ||
completer: $fish_completer | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#! /usr/bin/env nu | ||
|
||
def deviceid [cert: path] { | ||
# flawed actual implementation in syncthing (without reverse in luhn mod32) | ||
let s = open $cert | openssl x509 -outform der | hash sha256 -b | encode base32 | str trim -r -c '=' | ||
let charlist = (seq char A Z) ++ (seq 2 7) | ||
let charmap = $charlist | enumerate | reduce --fold {} {|it, acc| $acc | upsert ($it.item | into string) $it.index} | ||
0..3 | each {|i| $s | str substring ((13 * $i)..(13 * $i + 12))} | | ||
# each {|b| $b + ( $b| split chars | reverse | enumerate | reduce --fold 0 {|it, acc| | ||
each {|b| $b + ( $b| split chars | enumerate | reduce --fold 0 {|it, acc| | ||
let factor = if ($it.index mod 2 | into bool) { 2 } else { 1 } | ||
let addend = $factor * ($charmap | get $it.item) | ||
$acc + ($addend // 32) + ($addend mod 32) }| | ||
each {|s| let remainder = $s mod 32; (32 - $remainder) mod 32 }| | ||
each {|n| $charlist | get $n } | into string)} | | ||
each {|b| [ ($b | str substring 0..6) ($b | str substring 7..13) ]} | flatten | | ||
reduce {|it, acc| $acc + "-" + $it} | ||
} | ||
|
||
def main [cert: path] { | ||
deviceid $cert | ||
} |
Oops, something went wrong.