Merge branch 'master' into symorton/podspec2
This commit is contained in:
Коммит
f055fd4c5a
|
@ -1,3 +1,5 @@
|
|||
*This project is currently being moved to [Microsoft Entra Verified Id Wallet Library](https://github.com/microsoft/entra-verifiedid-wallet-library-ios). Feel free to browse the code, but we will not support this library moving forward.*
|
||||
|
||||
This SDK is used in the [Microsoft Authenticator app](https://www.microsoft.com/en-us/account/authenticator) in order to interact with [verifiable credentials](https://www.w3.org/TR/vc-data-model/) and [Decentralized Identifiers (DIDs)](https://www.w3.org/TR/did-core/) on the [ION network](https://github.com/decentralized-identity/ion). It can be integrated with any app to provide interactions using verifiable credentials.
|
||||
|
||||
# Verifiable Credentials
|
||||
|
|
|
@ -64,11 +64,11 @@ public struct PresentationRequestValidator: RequestValidating {
|
|||
throw PresentationRequestValidatorError.keyIdInTokenHeaderMalformed
|
||||
}
|
||||
|
||||
let publicKeyId = "#\(keyIdComponents[1])"
|
||||
|
||||
/// check if key id is equal to keyId fragment in token header, and if so, validate signature. Else, continue loop.
|
||||
/// check if key id is equal to keyId (fragment) in token header, and if so, validate signature. Else, continue loop.
|
||||
let publicKeyIds: Set = [kid, "#\(keyIdComponents[1])"]
|
||||
for key in keys {
|
||||
if key.id == publicKeyId,
|
||||
if let keyId = key.id,
|
||||
publicKeyIds.contains(keyId),
|
||||
try token.verify(using: verifier, withPublicKey: key.publicKeyJwk) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -27,6 +27,21 @@ class PresentationRequestValidatorTests: XCTestCase {
|
|||
MockTokenVerifier.wasVerifyCalled = false
|
||||
}
|
||||
|
||||
func testAbsoluteURLPublicKeyId() throws {
|
||||
let keyId = "did:test#keyId"
|
||||
let validator = PresentationRequestValidator(verifier: verifier)
|
||||
let mockRequestClaims = createMockPresentationRequestClaims()
|
||||
if let mockRequest = PresentationRequestToken(headers: Header(keyId: keyId),content: mockRequestClaims) {
|
||||
let didPublicKey = IdentifierDocumentPublicKey(id: keyId,
|
||||
type: "Typetest",
|
||||
controller: "controllerTest",
|
||||
publicKeyJwk: mockPublicKey,
|
||||
purposes: ["purpose"])
|
||||
try validator.validate(request: mockRequest, usingKeys: [didPublicKey])
|
||||
XCTAssertTrue(MockTokenVerifier.wasVerifyCalled)
|
||||
}
|
||||
}
|
||||
|
||||
func testShouldBeValid() throws {
|
||||
let validator = PresentationRequestValidator(verifier: verifier)
|
||||
let mockRequestClaims = createMockPresentationRequestClaims()
|
||||
|
|
|
@ -108,8 +108,8 @@ public class CoreDataManager {
|
|||
container.loadPersistentStores {
|
||||
[weak self] (storeDescription, error) in
|
||||
|
||||
if let err = error?.localizedDescription {
|
||||
sdkLog.logError(message: err)
|
||||
if let err = error {
|
||||
sdkLog.logError(message: String(describing: err))
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче