Crates.io | ic_auth_verifier |
lib.rs | ic_auth_verifier |
version | 0.6.1 |
created_at | 2025-03-11 09:00:14.215608+00 |
updated_at | 2025-08-26 03:27:37.512273+00 |
description | A Rust library used for integrating with IC-Auth. |
homepage | |
repository | https://github.com/ldclabs/ic-auth/tree/main/src/ic_auth_verifier |
max_upload_size | |
id | 1587697 |
size | 145,377 |
ic_auth_verifier
IC-Auth is a web authentication system based on the Internet Computer.
ic_auth_verifier
is a Rust library for signing and verifying cryptographic signatures in the IC-Auth ecosystem.
envelope
feature)identity
feature)Add this to your Cargo.toml
:
[dependencies]
ic_auth_verifier = "0.4" # Replace with the latest version
To enable the envelope
feature:
[dependencies]
ic_auth_verifier = { version = "0.4", features = ["envelope"] }
To enable the identity
feature (It can not be compiled in canister):
[dependencies]
ic_auth_verifier = { version = "0.4", features = ["identity"] }
use ic_auth_verifier::SignedEnvelope;
let identity = /* your ICP Identity */;
let message = b"message";
let envelope = SignedEnvelope::sign_message(&identity, message)?;
// Adds the SignedEnvelope to the Authorization header to be sent to the service which will verify the signature.
envelope.to_authorization(&mut headers)?;
// Or adds the SignedEnvelope components to the IC-Auth-* HTTP headers.
// envelope.to_headers(&mut headers)?;
use ic_auth_verifier::{SignedEnvelope, unix_timestamp};
let envelope = SignedEnvelope::from_authorization(&headers).unwrap();
// Verify the envelope
envelope.verify(unix_timestamp().as_millis() as u64, None, None)?;
Copyright © 2024-2025 LDC Labs.
ldclabs/ic-auth
is licensed under the MIT License. See LICENSE for the full license text.