-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from TBD54566975/minor-test-cleanup
fix: lint warnings and test output
- Loading branch information
Showing
7 changed files
with
59 additions
and
48 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
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,19 @@ | ||
import 'package:tbdex/src/jwt.dart'; | ||
import 'package:tbdex/tbdex.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('Jwt', () { | ||
test('should parse signed JWT', () async { | ||
final km = InMemoryKeyManager(); | ||
final did = await DidJwk.create(keyManager: km); | ||
|
||
final signedJwt = | ||
await Jwt.sign(did: did, jwtPayload: JwtPayload(iss: did.uri)); | ||
|
||
final parsedJwt = Jwt.parse(signedJwt); | ||
expect(parsedJwt.decoded.header.kid, contains("${did.uri}#")); | ||
expect(parsedJwt.decoded.payload.iss, equals(did.uri)); | ||
}); | ||
}); | ||
} |
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,20 @@ | ||
import 'dart:convert'; | ||
import 'dart:typed_data'; | ||
|
||
import 'package:tbdex/src/crypto/secp256k1.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('Secp256k1', () { | ||
test('should verify public key', () async { | ||
final secp256k1 = Secp256k1(); | ||
|
||
final privateKeyJwk = await secp256k1.generatePrivateKey(); | ||
final payload = Uint8List.fromList(utf8.encode("hello")); | ||
final signature = await secp256k1.sign(privateKeyJwk, payload); | ||
|
||
final publicKeyJwk = await secp256k1.computePublicKey(privateKeyJwk); | ||
await secp256k1.verify(publicKeyJwk, payload, signature); | ||
}); | ||
}); | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.