Skip to content

noandrea/rl2020.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RevocationList2020

This library provides the implementation for the RevocationList2020 proposal described here.

Demo

The following demo uses the wasm library on a web page.

Demo

To run the demo locally, build the javascript library using:

wasm-pack build --target web --debug

and then launch a local web server, for example using python:

python3 -m http.server 7654

Usage/Examples

The following example shows how to use the library with Rust.

println!("Hello, RevocationList2020!");
// create a new revocation list
let mut rl = RevocationList2020::new("https://example.com/credentials/status/3", 16).unwrap();
println!("{}", rl);
// create a credential that uses the revocation list
let c = create_credential();
let c_idx = c.credential_status.revocation_list_index;
// check if the credential is revoked
let revoked = rl.is_revoked(&c).unwrap();
println!("credential at index {} is revoked? {}", c_idx, revoked);
// revoke the credential
println!("revoking credential at index {}", c_idx);
rl.revoke(&c).unwrap();
// print the updated revocation list
println!("{}", rl);
//check if the credential is revoked
let revoked = rl.is_revoked(&c).unwrap();
println!("credential at index {} is revoked? {}", c_idx, revoked);
// reset the credential revocation
println!("resetting status for credential at index {}", c_idx);
rl.reset(&c).unwrap();
// print the updated revocation list
println!("{}", rl);
//check if the credential is revoked
let revoked = rl.is_revoked(&c).unwrap();
println!("credential at index {} is revoked? {}", c_idx, revoked);

To run the example locally use the command:

cargo run --example main

Running Tests

To run tests, run the following command

  cargo test

Installation

Rust

The rust library is published on crates.io

Npm

The wasm library is published on npmjs

About

Rust implementation for RevocationList2020 proposal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published