-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: verify zig with minisign (#3793)
* feat: verify zig with minisign * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
13c9cb5
commit de66eae
Showing
11 changed files
with
124 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
assert "mise x zig@0.13.0 -- zig version" "0.13.0" | ||
assert "mise x zig@ref:master -- zig version" |
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,9 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
# TODO: enable this after next release | ||
#assert "mise generate bootstrap -w" | ||
#assert "./bin/mise -v" "xx" | ||
# | ||
#assert "mise task add xxx -- echo 'running xxx'" | ||
#assert "mise generate task-stubs --mise-bin ./bin/mise" | ||
#assert "./bin/xxx" "running xxx" | ||
assert "mise generate bootstrap -w" | ||
assert "./bin/mise version" | ||
|
||
assert "mise task add xxx -- echo 'running xxx'" | ||
assert "mise generate task-stubs --mise-bin ./bin/mise" | ||
assert "./bin/xxx" "running xxx" |
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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
use crate::*; | ||
use minisign_verify::*; | ||
#[allow(dead_code)] | ||
pub const MISE_PUB_KEY: &str = include_str!("../minisign.pub"); | ||
use std::iter::Iterator; | ||
use std::sync::LazyLock; | ||
|
||
#[allow(dead_code)] | ||
pub fn verify(pub_key: &str, data: &str, sig: &str) -> Result<()> { | ||
pub static MISE_PUB_KEY: LazyLock<String> = LazyLock::new(|| { | ||
include_str!("../minisign.pub") | ||
.to_string() | ||
.lines() | ||
.last() | ||
.unwrap() | ||
.to_string() | ||
}); | ||
|
||
pub fn verify(pub_key: &str, data: &[u8], sig: &str) -> Result<()> { | ||
let public_key = PublicKey::from_base64(pub_key)?; | ||
let signature = Signature::decode(sig)?; | ||
public_key.verify(data.as_bytes(), &signature, false)?; | ||
public_key.verify(data, &signature, false)?; | ||
Ok(()) | ||
} |
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