Skip to content

Commit e64232a

Browse files
committed
Relax strictness of verification checks
This fixes an issue where a valid keyID may not pass validation since getVerificationInformation() was too strict in how the string is validated.
1 parent aada36d commit e64232a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Sources/ATCommonWeb/TypeScript-bound/DIDDocument.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ public struct DIDDocument: Sendable, Codable {
116116
/// - Returns: A tuple, which contains the verification type and the multibase public key, or `nil` (if
117117
/// it failed to find one).
118118
public func getVerificationInformation(keyID: String) -> (type: String, multibasePublicKey: String)? {
119-
let key = self.verificationMethod?.first { $0.id == "#\(keyID)" }
119+
let key = self.verificationMethod?.first {
120+
// Partially inspired by: https://bsky.app/profile/did:plc:6e4trbg7t5srtrez7yy7msn3/post/3lu2yxd4nns2a
121+
$0.id == "#\(keyID)" || $0.id == "\(self.id)#\(keyID)"
122+
}
120123

121124
guard let key = key else {
122125
return nil

0 commit comments

Comments
 (0)