this repo has no description
1import Foundation
2import Testing
3@testable import CoreATProtocol
4
5@Test("Client metadata decodes from sample JSON")
6func decodeClientMetadata() throws {
7 let json = """
8 {
9 "client_id": "https://sparrowtek.com/plume.json",
10 "client_name": "Plume iOS",
11 "application_type": "native",
12 "grant_types": [
13 "authorization_code",
14 "refresh_token"
15 ],
16 "scope": "atproto",
17 "response_types": [
18 "code"
19 ],
20 "redirect_uris": [
21 "com.sparrowtek.plume:/oauth/callback"
22 ],
23 "token_endpoint_auth_method": "none",
24 "dpop_bound_access_tokens": true,
25 "client_uri": "https://sparrowtek.com",
26 "policy_uri": "https://sparrowtek.com/privacy",
27 "tos_uri": "https://sparrowtek.com/terms"
28 }
29 """.data(using: .utf8)!
30
31 let decoder = JSONDecoder()
32 decoder.keyDecodingStrategy = .convertFromSnakeCase
33 let metadata = try decoder.decode(OAuthClientMetadata.self, from: json)
34 #expect(metadata.clientID.absoluteString == "https://sparrowtek.com/plume.json")
35 #expect(metadata.redirectURIs.count == 1)
36 #expect(metadata.dPoPBoundAccessTokens)
37}