Auto-indexing service and GraphQL API for AT Protocol Records
quickslice.slices.network/
atproto
gleam
graphql
1import gleam/option
2import gleeunit
3import gleeunit/should
4import jose_wrapper
5
6pub fn main() {
7 gleeunit.main()
8}
9
10pub fn generate_dpop_proof_test() {
11 // Fake test JWK (not a real key - for testing only)
12 let jwk_json =
13 "{\"kid\":\"did:key:zFAKEKEYFORTESTINGONLY123456789\",\"alg\":\"ES256\",\"use\":\"sig\",\"kty\":\"EC\",\"crv\":\"P-256\",\"x\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\"y\":\"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\",\"d\":\"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\"}"
14
15 let method = "POST"
16 let url =
17 "https://leccinum.us-west.host.bsky.network/xrpc/com.atproto.repo.createRecord"
18 let access_token = "test_token_12345"
19
20 case
21 jose_wrapper.generate_dpop_proof_with_nonce(
22 method,
23 url,
24 access_token,
25 jwk_json,
26 option.None,
27 )
28 {
29 Ok(dpop_proof) -> {
30 // DPoP proof should be a JWT (three parts separated by dots)
31 should.not_equal(dpop_proof, "")
32
33 // Should start with eyJ (base64 encoded JSON header)
34 should.be_true(case dpop_proof {
35 "eyJ" <> _ -> True
36 _ -> False
37 })
38 }
39 Error(_err) -> {
40 should.fail()
41 }
42 }
43}