-
Notifications
You must be signed in to change notification settings - Fork 14
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
20 changed files
with
1,044 additions
and
963 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:oidc4vc/oidc4vc.dart'; | ||
|
||
void main() { | ||
group('ClientAuthenticationX', () { | ||
test('value', () { | ||
expect(ClientAuthentication.none.value, 'none'); | ||
expect( | ||
ClientAuthentication.clientSecretBasic.value, 'client_secret_basic'); | ||
expect(ClientAuthentication.clientSecretPost.value, 'client_secret_post'); | ||
expect(ClientAuthentication.clientId.value, 'client_id'); | ||
expect(ClientAuthentication.clientSecretJwt.value, 'client_secret_jwt'); | ||
}); | ||
}); | ||
} |
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,12 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:oidc4vc/oidc4vc.dart'; | ||
|
||
void main() { | ||
group('ClientTypeX', () { | ||
test('getTitle', () { | ||
expect(ClientType.p256JWKThumprint.getTitle, 'P-256 JWK Thumbprint'); | ||
expect(ClientType.did.getTitle, 'DID'); | ||
expect(ClientType.confidential.getTitle, 'Confidential Client'); | ||
}); | ||
}); | ||
} |
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,21 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:oidc4vc/src/helper_function.dart'; | ||
|
||
void main() { | ||
group('listToString', () { | ||
test('converts list of strings to a single string with spaces', () { | ||
final inputList = ['This', 'is', 'Bibash']; | ||
expect(listToString(inputList), 'This is Bibash'); | ||
}); | ||
|
||
test('converts list of numbers to a single string with spaces', () { | ||
final inputList = [1, 2, 3, 4]; | ||
expect(listToString(inputList), '1 2 3 4'); | ||
}); | ||
|
||
test('returns empty string for empty input list', () { | ||
final inputList = <String>[]; | ||
expect(listToString(inputList), ''); | ||
}); | ||
}); | ||
} |
107 changes: 66 additions & 41 deletions
107
packages/oidc4vc/test/src/issuer_token_parameters/issuer_token_parameters_class.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 |
---|---|---|
@@ -1,41 +1,66 @@ | ||
// import 'package:flutter_test/flutter_test.dart'; | ||
// import 'package:oidc4vc/oidc4vc.dart'; | ||
|
||
// import '../const_values.dart'; | ||
// import '../token_parameters/token_parameters_class.dart'; | ||
|
||
// class IssuerTokenParameterTest extends TokenParameterTest { | ||
// final issuerTokenParameters = IssuerTokenParameters(privateKey, '', '', ''); | ||
|
||
// @override | ||
// void publicKeyTest() { | ||
// expect(issuerTokenParameters.publicJWK, publicJWK); | ||
// } | ||
|
||
// @override | ||
// void didTest() { | ||
// expect(tokenParameters.did, didKey); | ||
// } | ||
|
||
// @override | ||
// void keyIdTest() { | ||
// expect(tokenParameters.kid, kid); | ||
// } | ||
|
||
// @override | ||
// void algorithmIsES256KTest() { | ||
// expect(tokenParameters.alg, ES256KAlg); | ||
// } | ||
|
||
// @override | ||
// void algorithmIsES256Test() { | ||
// final tokenParameters = IssuerTokenParameters(privateKey2, '', '', ''); | ||
// expect(tokenParameters.alg, ES256Alg); | ||
// } | ||
|
||
// @override | ||
// void algorithmIsNotNullTest() { | ||
// final tokenParameters = IssuerTokenParameters(keyWithAlg, '', '', ''); | ||
// expect(tokenParameters.alg, HS256Alg); | ||
// } | ||
// } | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:oidc4vc/oidc4vc.dart'; | ||
|
||
import '../const_values.dart'; | ||
import '../token_parameters/token_parameters_class.dart'; | ||
|
||
class IssuerTokenParameterTest extends TokenParameterTest { | ||
final issuerTokenParameters = IssuerTokenParameters( | ||
privateKey: privateKey, | ||
clientId: clientId, | ||
did: clientId, | ||
clientType: ClientType.did, | ||
mediaType: MediaType.proofOfOwnership, | ||
proofHeaderType: ProofHeaderType.kid, | ||
issuer: issuer, | ||
kid: '', | ||
); | ||
|
||
@override | ||
void publicKeyTest() { | ||
expect(issuerTokenParameters.publicJWK, publicJWK); | ||
} | ||
|
||
@override | ||
void didTest() { | ||
expect(tokenParameters.did, clientId); | ||
} | ||
|
||
@override | ||
void keyIdTest() { | ||
expect(tokenParameters.kid, kid); | ||
} | ||
|
||
@override | ||
void algorithmIsES256KTest() { | ||
expect(tokenParameters.alg, ES256KAlg); | ||
} | ||
|
||
@override | ||
void algorithmIsES256Test() { | ||
final tokenParameters = IssuerTokenParameters( | ||
privateKey: privateKey2, | ||
clientId: clientId, | ||
did: clientId, | ||
clientType: ClientType.did, | ||
mediaType: MediaType.proofOfOwnership, | ||
proofHeaderType: ProofHeaderType.kid, | ||
issuer: issuer, | ||
); | ||
expect(tokenParameters.alg, ES256Alg); | ||
} | ||
|
||
@override | ||
void algorithmIsNotNullTest() { | ||
final tokenParameters = IssuerTokenParameters( | ||
privateKey: keyWithAlg, | ||
clientId: clientId, | ||
did: clientId, | ||
clientType: ClientType.did, | ||
mediaType: MediaType.proofOfOwnership, | ||
proofHeaderType: ProofHeaderType.kid, | ||
issuer: issuer, | ||
); | ||
expect(tokenParameters.alg, HS256Alg); | ||
} | ||
} |
94 changes: 47 additions & 47 deletions
94
packages/oidc4vc/test/src/issuer_token_parameters/issuer_token_parameters_test.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 |
---|---|---|
@@ -1,47 +1,47 @@ | ||
// import 'package:flutter_test/flutter_test.dart'; | ||
|
||
// import 'issuer_token_parameters_class.dart'; | ||
|
||
// void main() { | ||
// group('override test', () { | ||
// final issuerTokenParameterTest = IssuerTokenParameterTest(); | ||
|
||
// // test( | ||
// // 'public key is P-256K private key without d parameter', | ||
// // issuerTokenParameterTest.publicKeyTest, | ||
// // ); | ||
|
||
// // test('did EBSI', issuerTokenParameterTest.didTest); | ||
|
||
// // test('kID EBSI', issuerTokenParameterTest.keyIdTest); | ||
|
||
// group('algorithm test', () { | ||
// test( | ||
// "algorithm is ES256K when key's curve is not P-256", | ||
// issuerTokenParameterTest.algorithmIsES256KTest, | ||
// ); | ||
|
||
// test( | ||
// "algorithm is ES256 when key's curve is P-256", | ||
// issuerTokenParameterTest.algorithmIsES256Test, | ||
// ); | ||
|
||
// test( | ||
// 'if alg is not null then return as it is', | ||
// issuerTokenParameterTest.algorithmIsNotNullTest, | ||
// ); | ||
// }); | ||
|
||
// // group('thumbprint test', () { | ||
// // test( | ||
// // 'thumbprint of the public Key', | ||
// // issuerTokenParameterTest.thumprintOfKey, | ||
// // ); | ||
|
||
// // test( | ||
// // 'thumbrprint of the Key from exemple in rfc 7638', | ||
// // issuerTokenParameterTest.thumprintOfKeyForrfc7638, | ||
// // ); | ||
// // }); | ||
// }); | ||
// } | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import 'issuer_token_parameters_class.dart'; | ||
|
||
void main() { | ||
group('override test', () { | ||
final issuerTokenParameterTest = IssuerTokenParameterTest(); | ||
|
||
test( | ||
'public key is P-256K private key without d parameter', | ||
issuerTokenParameterTest.publicKeyTest, | ||
); | ||
|
||
test('did EBSI', issuerTokenParameterTest.didTest); | ||
|
||
test('kID EBSI', issuerTokenParameterTest.keyIdTest); | ||
|
||
group('algorithm test', () { | ||
test( | ||
"algorithm is ES256K when key's curve is not P-256", | ||
issuerTokenParameterTest.algorithmIsES256KTest, | ||
); | ||
|
||
test( | ||
"algorithm is ES256 when key's curve is P-256", | ||
issuerTokenParameterTest.algorithmIsES256Test, | ||
); | ||
|
||
test( | ||
'if alg is not null then return as it is', | ||
issuerTokenParameterTest.algorithmIsNotNullTest, | ||
); | ||
}); | ||
|
||
group('thumbprint test', () { | ||
test( | ||
'thumbprint of the public Key', | ||
issuerTokenParameterTest.thumprintOfKey, | ||
); | ||
|
||
test( | ||
'thumbrprint of the Key from exemple in rfc 7638', | ||
issuerTokenParameterTest.thumprintOfKeyForrfc7638, | ||
); | ||
}); | ||
}); | ||
} |
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,13 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:oidc4vc/oidc4vc.dart'; | ||
|
||
void main() { | ||
group('MediaTypeX', () { | ||
test('typ', () { | ||
expect(MediaType.proofOfOwnership.typ, 'openid4vci-proof+jwt'); | ||
expect(MediaType.basic.typ, 'JWT'); | ||
expect(MediaType.walletAttestation.typ, 'wiar+jwt'); | ||
expect(MediaType.selectiveDisclosure.typ, 'kb+jwt'); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.