-
Notifications
You must be signed in to change notification settings - Fork 61
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
Showing
5 changed files
with
2,003 additions
and
0 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 |
---|---|---|
|
@@ -99,6 +99,7 @@ members = [ | |
"did-sol", | ||
"did-pkh", | ||
"did-onion", | ||
"did-ion", | ||
"did-webkey", | ||
"vc-test", | ||
"did-test", | ||
|
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,33 @@ | ||
[package] | ||
name = "did-ion" | ||
version = "0.1.0" | ||
authors = ["Spruce Systems, Inc."] | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
keywords = ["ssi", "did"] | ||
categories = ["web-programming::http-client"] | ||
description = "did:ion DID method implementation, using the ssi crate and ION/Sidetree REST API" | ||
repository = "https://github.com/spruceid/ssi/" | ||
homepage = "https://github.com/spruceid/ssi/tree/main/did-ion/" | ||
documentation = "https://docs.rs/did-ion/" | ||
|
||
[features] | ||
|
||
[dependencies] | ||
ssi = { version = "0.3", path = "../", default-features = false, features = ["http-did", "secp256k1"] } | ||
async-trait = "0.1" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
serde_jcs = "0.1" | ||
anyhow = "1.0" | ||
base64 = "0.12" | ||
sha2 = "0.10" | ||
json-patch = "0.2.6" | ||
reqwest = { version = "0.11", features = ["json"] } | ||
|
||
[target.'cfg(target_os = "android")'.dependencies.reqwest] | ||
version = "0.11" | ||
features = ["json", "native-tls-vendored"] | ||
|
||
[dev-dependencies] | ||
lazy_static = "1.4" |
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,17 @@ | ||
# did-ion | ||
|
||
Rust implementation of the [did:ion][] [DID Method][], based on the [ssi][] library. | ||
|
||
## Requirements | ||
|
||
An ION node is needed, that is a [Sidetree REST API][] provider. The URL for | ||
the ION/Sidetree node is to be stored in config TBD. | ||
|
||
## License | ||
|
||
[Apache License, Version 2.0](http://www.apache.org/licenses/) | ||
|
||
[did:ion]: https://identity.foundation/ion/ | ||
[DID Method]: https://www.w3.org/TR/did-core/#methods | ||
[ssi]: https://github.com/spruceid/ssi/ | ||
[Sidetree REST API]: https://identity.foundation/sidetree/api/ |
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,26 @@ | ||
use anyhow::{ensure, Context, Error, Result}; | ||
use ssi::jwk::{Algorithm, JWK}; | ||
|
||
pub mod sidetree; | ||
|
||
use sidetree::{is_secp256k1, Sidetree, SidetreeClient}; | ||
|
||
pub struct ION; | ||
|
||
/// did:ion Method | ||
pub type DIDION = SidetreeClient<ION>; | ||
|
||
impl Sidetree for ION { | ||
fn generate_key() -> Result<JWK, Error> { | ||
JWK::generate_secp256k1().context("Generate secp256k1 key") | ||
} | ||
|
||
fn validate_key(key: &JWK) -> Result<(), Error> { | ||
ensure!(is_secp256k1(&key), "Key must be Secp256k1 for ION"); | ||
Ok(()) | ||
} | ||
|
||
const SIGNATURE_ALGORITHM: Algorithm = Algorithm::ES256K; | ||
const METHOD: &'static str = "ion"; | ||
const NETWORK: Option<&'static str> = Some("test"); | ||
} |
Oops, something went wrong.