Skip to content

Commit 357f64c

Browse files
committed
refactor: rename KeyId to PlainKeyId
This was done to avoid conflicts with its field `keyId` on case-insensitive file systems.
1 parent bbe52d2 commit 357f64c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

example/dcaf_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void main() {
2828
clientId: "myclient",
2929
audience: "valve242",
3030
scope: TextScope("read"),
31-
reqCnf: KeyId([0xDC, 0xAF]));
31+
reqCnf: PlainKeyId([0xDC, 0xAF]));
3232
final List<int> serializedRequest = request.serialize();
3333
assert(AccessTokenRequest.fromSerialized(serializedRequest) == request);
3434

lib/src/pop.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import 'endpoints/token_response.dart';
2020
/// [RFC 8747, section 3.1](https://datatracker.ietf.org/doc/html/rfc8747#section-3.1).
2121
///
2222
/// Can either be a [PlainCoseKey], an [EncryptedCoseKey] (note that
23-
/// this is not yet fully supported), or simply a [KeyId].
23+
/// this is not yet fully supported), or simply a [PlainKeyId].
2424
/// As described in [`draft-ietf-ace-oauth-params-16`](https://datatracker.ietf.org/doc/html/draft-ietf-ace-oauth-params-16),
2525
/// PoP keys are used for the `reqCnf` parameter in [AccessTokenRequest]
2626
/// as well as for the `cnf` and `rsCnf` parameters in [AccessTokenResponse].
@@ -59,7 +59,7 @@ abstract class ProofOfPossessionKey extends CborMapSerializable {
5959
throw FormatException(
6060
"Key ID must consist of CBOR bytestring.", value);
6161
}
62-
return KeyId.fromValue(value);
62+
return PlainKeyId.fromValue(value);
6363
default:
6464
throw FormatException(
6565
"Unknown ProofOfPossessionKey type '${entry.key}'.", entry);
@@ -73,27 +73,27 @@ abstract class ProofOfPossessionKey extends CborMapSerializable {
7373
}
7474
}
7575

76-
/// Key ID of the actual proof-of-possession key.
76+
/// Proof-of-possession key represented by only its Key ID.
7777
///
7878
/// Note that as described in [section 6 of RFC 8747](https://datatracker.ietf.org/doc/html/rfc8747#section-6),
7979
/// certain caveats apply when choosing to represent a
8080
/// [ProofOfPossessionKey] by its Key ID.
8181
///
8282
/// For details, see [section 3.4 of RFC 8747](https://datatracker.ietf.org/doc/html/rfc8747#section-3.4).
83-
class KeyId extends ProofOfPossessionKey {
83+
class PlainKeyId extends ProofOfPossessionKey {
8484
@override
8585
ByteString keyId;
8686

87-
/// Creates a new [KeyId] instance.
88-
KeyId(this.keyId) : super._();
87+
/// Creates a new [PlainKeyId] instance.
88+
PlainKeyId(this.keyId) : super._();
8989

9090
@override
9191
Map<int, CborValue> toCborMap() {
9292
return {3: CborBytes(keyId)};
9393
}
9494

95-
/// Creates a new [KeyId] instance from the given CBOR [bytes].
96-
KeyId.fromValue(CborBytes bytes) : this(bytes.bytes);
95+
/// Creates a new [PlainKeyId] instance from the given CBOR [bytes].
96+
PlainKeyId.fromValue(CborBytes bytes) : this(bytes.bytes);
9797

9898
@override
9999
String toString() {
@@ -103,7 +103,7 @@ class KeyId extends ProofOfPossessionKey {
103103
@override
104104
bool operator ==(Object other) =>
105105
identical(this, other) ||
106-
other is KeyId &&
106+
other is PlainKeyId &&
107107
runtimeType == other.runtimeType &&
108108
keyId.nullableEquals(other.keyId);
109109

test/dcaf_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ void main() {
343343
clientId: "myclient",
344344
audience: "valve424",
345345
scope: TextScope("read"),
346-
reqCnf: KeyId([0xea, 0x48, 0x34, 0x75, 0x72, 0x4c, 0xd7, 0x75]));
346+
reqCnf: PlainKeyId([0xea, 0x48, 0x34, 0x75, 0x72, 0x4c, 0xd7, 0x75]));
347347
expectSerDeRequest(request,
348348
"A404A10348EA483475724CD775056876616C76653432340964726561641818686D79636C69656E74");
349349
});

0 commit comments

Comments
 (0)