-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probably too much #29
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2c2db22
some refactoring and initial stab at jws signing/verification
mistermoe 129eb3b
reorganize `web5` package
mistermoe f8daaed
add todo
mistermoe fa5dbae
addressing PR comments
mistermoe 0c9dda6
address PR comments
mistermoe 97b8889
address PR comment
mistermoe f358533
address PR comments
mistermoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ linter: | |
- prefer_final_locals | ||
- require_trailing_commas | ||
- unnecessary_late | ||
- prefer_single_quotes |
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,13 +1,11 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:web5/web5.dart'; | ||
|
||
void main() async { | ||
final keyManager = InMemoryKeyManager(); | ||
|
||
final did = await DidJwk.create(keyManager: keyManager); | ||
print(did.uri); | ||
// LOAD PRE-EXISTING | ||
// final did = DidJwk(uri: "some_uri", keyManager: keyManager); | ||
|
||
final didResolutionResult = DidJwk.resolve(did.uri); | ||
print(jsonEncode(didResolutionResult)); | ||
// CREATE | ||
// final did = DidJwk.create(keyManager: keyManager); | ||
} |
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,9 @@ | ||
export './crypto/jwk.dart'; | ||
export './crypto/dsa.dart'; | ||
export './crypto/ed25519.dart'; | ||
export './crypto/dsa_name.dart'; | ||
export './crypto/dsa_alias.dart'; | ||
export './crypto/secp256k1.dart'; | ||
export './crypto/key_manager.dart'; | ||
export './crypto/dsa_algorithms.dart'; | ||
export './crypto/in_memory_key_manager.dart'; | ||
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class DsaAlias { | ||
String? algorithm; | ||
String? curve; | ||
|
||
DsaAlias({this.algorithm, this.curve}); | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
return other is DsaAlias && | ||
other.algorithm == algorithm && | ||
other.curve == curve; | ||
} | ||
|
||
@override | ||
int get hashCode => algorithm.hashCode ^ curve.hashCode; | ||
} |
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,27 @@ | ||
import 'package:web5/src/crypto/dsa_alias.dart'; | ||
|
||
/// Enum [DsaName] representing supported Digital Signature Algorithm (DSA) names. | ||
enum DsaName { | ||
secp256k1('ES256K', 'secp256k1', 'EC'), | ||
ed25519('EdDSA', 'Ed25519', 'OKP'); | ||
|
||
static final _aliases = { | ||
DsaAlias(algorithm: 'EdDSA', curve: 'Ed25519'): DsaName.ed25519, | ||
DsaAlias(algorithm: null, curve: 'Ed25519'): DsaName.ed25519, | ||
DsaAlias(algorithm: 'ES256K', curve: 'secp256k1'): DsaName.secp256k1, | ||
DsaAlias(algorithm: 'ES256K', curve: null): DsaName.secp256k1, | ||
DsaAlias(algorithm: null, curve: 'secp256k1'): DsaName.secp256k1, | ||
}; | ||
|
||
final String algorithm; | ||
final String curve; | ||
final String kty; | ||
|
||
const DsaName(this.algorithm, this.curve, this.kty); | ||
|
||
/// method that can be used to find [DsaName] using | ||
/// [JWA](https://datatracker.ietf.org/doc/html/rfc7518.html) algorithm and | ||
/// curve names | ||
static DsaName? findByAlias({String? algorithm, String? curve}) => | ||
_aliases[DsaAlias(algorithm: algorithm, curve: curve)]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export './dids/did.dart'; | ||
export './dids/did_uri.dart'; | ||
export './dids/data_models.dart'; | ||
export './dids/did_resolver.dart'; | ||
export './dids/did_dht/did_dht.dart'; | ||
export './dids/did_jwk/did_jwk.dart'; | ||
export './dids/did_method_resolver.dart'; |
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,11 @@ | ||
export 'structures/service.dart'; | ||
export 'structures/did_resource.dart'; | ||
export 'structures/did_document.dart'; | ||
export 'structures/resolution_result.dart'; | ||
export 'structures/dereference_result.dart'; | ||
export 'structures/verification_method.dart'; | ||
export 'structures/resolution_metadata.dart'; | ||
export 'structures/dereference_options.dart'; | ||
export 'structures/dereference_metadata.dart'; | ||
export 'structures/did_document_metadata.dart'; | ||
export 'structures/verification_relationship.dart'; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export './dns_packet/answer.dart'; | ||
export './dns_packet/class.dart'; | ||
export './dns_packet/consts.dart'; | ||
export './dns_packet/header.dart'; | ||
export './dns_packet/name.dart'; | ||
export './dns_packet/opcode.dart'; | ||
export './dns_packet/opt_data.dart'; | ||
export './dns_packet/option_code.dart'; | ||
export './dns_packet/packet.dart'; | ||
export './dns_packet/question.dart'; | ||
export './dns_packet/rcode.dart'; | ||
export './dns_packet/rdata.dart'; | ||
export './dns_packet/txt_data.dart'; | ||
export './dns_packet/type.dart'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!