Expand description
Verification and signing utilities for IC-Auth.
The base crate verifies raw signatures for the public key formats used by Internet Computer identities: Ed25519, ECDSA P-256, ECDSA secp256k1, and IC canister signatures. Optional features add higher-level protocol surfaces:
envelope:SignedEnvelopeparsing, verification, HTTP headers, and deep-link payload helpers.identity:ic-agentidentity helpers for clients and services that need to sign envelopes. This feature is intended for native/server targets, not canisters.
§Examples
use ic_auth_verifier::{Algorithm, sha256, verify_basic_sig};
let digest = sha256(b"message");
assert_eq!(digest.len(), 32);
let err = verify_basic_sig(Algorithm::IcCanisterSignature, &[], b"message", &[])
.unwrap_err();
assert!(err.contains("not supported"));Re-exports§
Modules§
Structs§
- Canister
SigPublic Key - A public key of canister signatures, see https://internetcomputer.org/docs/current/references/ic-interface-spec#canister-signatures
Enums§
- Algorithm
- Public-key algorithms recognized in IC identity DER public keys.
Constants§
Functions§
- keccak256
- Computes Keccak-256 for
data. - rand_
bytes - Returns
Ncryptographically random bytes. - sha3_
256 - Computes SHA3-256 for
data. - sha256
- Computes SHA-256 for
data. - user_
public_ key_ from_ der - Parses a DER SubjectPublicKeyInfo public key.
- verify_
basic_ sig - Verifies a raw signature for non-canister public keys.
- verify_
canister_ sig - Verifies that
signatureis a valid canister signature onmessage. https://internetcomputer.org/docs/current/references/ic-interface-spec#canister-signatures