Skip to content

Commit 569b328

Browse files
committed
chore: fix formatting
1 parent 73915d9 commit 569b328

9 files changed

Lines changed: 17 additions & 56 deletions

File tree

src/gose/cose.gleam

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ pub fn headers_from_cbor(
148148
}
149149

150150
@internal
151-
pub fn headers_to_cbor(
152-
headers: List(Header),
153-
) -> List(#(cbor.Value, cbor.Value)) {
151+
pub fn headers_to_cbor(headers: List(Header)) -> List(#(cbor.Value, cbor.Value)) {
154152
list.map(headers, header_to_cbor)
155153
}
156154

src/gose/cose/sign1.gleam

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,19 +284,13 @@ pub fn with_detached(message: Sign1(Unsigned)) -> Sign1(Unsigned) {
284284
}
285285

286286
/// Set external additional authenticated data (AAD) for the signing operation.
287-
pub fn with_aad(
288-
message: Sign1(Unsigned),
289-
aad aad: BitArray,
290-
) -> Sign1(Unsigned) {
287+
pub fn with_aad(message: Sign1(Unsigned), aad aad: BitArray) -> Sign1(Unsigned) {
291288
let assert UnsignedSign1(..) = message
292289
UnsignedSign1(..message, aad:)
293290
}
294291

295292
/// Add a key ID to the unprotected headers.
296-
pub fn with_kid(
297-
message: Sign1(Unsigned),
298-
kid kid: BitArray,
299-
) -> Sign1(Unsigned) {
293+
pub fn with_kid(message: Sign1(Unsigned), kid kid: BitArray) -> Sign1(Unsigned) {
300294
let assert UnsignedSign1(unprotected:, ..) = message
301295
UnsignedSign1(..message, unprotected: [cose.Kid(kid), ..unprotected])
302296
}
@@ -369,9 +363,7 @@ fn build_sig_structure(
369363
)
370364
}
371365

372-
fn parse_cbor_value(
373-
value: cbor.Value,
374-
) -> Result(Sign1(Signed), gose.GoseError) {
366+
fn parse_cbor_value(value: cbor.Value) -> Result(Sign1(Signed), gose.GoseError) {
375367
use items <- result.try(cose_structure.parse_cose_array_value(
376368
value,
377369
expected_tag: 18,

src/gose/internal/key_extract.gleam

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import gose/key
55
import kryptos/rsa
66

7-
pub fn rsa_private_key(
8-
material: key.KeyMaterial,
9-
) -> Result(rsa.PrivateKey, Nil) {
7+
pub fn rsa_private_key(material: key.KeyMaterial) -> Result(rsa.PrivateKey, Nil) {
108
case material {
119
key.Rsa(key.RsaPrivate(key: private, ..)) -> Ok(private)
1210
_ -> Error(Nil)

src/gose/internal/utils.gleam

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ pub fn ec_public_key_from_coordinates(
8686
}
8787

8888
/// Parse an EdDSA curve from its JWK string representation.
89-
pub fn eddsa_curve_from_string(
90-
s: String,
91-
) -> Result(eddsa.Curve, gose.GoseError) {
89+
pub fn eddsa_curve_from_string(s: String) -> Result(eddsa.Curve, gose.GoseError) {
9290
case s {
9391
"Ed25519" -> Ok(eddsa.Ed25519)
9492
"Ed448" -> Ok(eddsa.Ed448)

src/gose/jose/jwe.gleam

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,7 @@ pub fn new_chacha20_kw(
378378
/// let assert Ok(encrypted) = jwe.new_direct(algorithm.AesGcm(algorithm.Aes256))
379379
/// |> jwe.encrypt(key, <<"hello":utf8>>)
380380
/// ```
381-
pub fn new_direct(
382-
enc: algorithm.ContentAlg,
383-
) -> Jwe(Unencrypted, Direct, Built) {
381+
pub fn new_direct(enc: algorithm.ContentAlg) -> Jwe(Unencrypted, Direct, Built) {
384382
Jwe(
385383
header: JweHeader(
386384
alg: algorithm.Direct,
@@ -1561,10 +1559,7 @@ fn try_keys(
15611559
}
15621560
}
15631561

1564-
fn header_to_json(
1565-
header: JweHeader,
1566-
alg_fields: ResolvedAlgFields,
1567-
) -> BitArray {
1562+
fn header_to_json(header: JweHeader, alg_fields: ResolvedAlgFields) -> BitArray {
15681563
let alg_field = #(
15691564
"alg",
15701565
json.string(jose_algorithm.key_encryption_alg_to_string(header.alg)),
@@ -2281,9 +2276,7 @@ fn parse_optional_base64(
22812276
/// When unprotected headers are present, includes the `unprotected` and/or `header` fields.
22822277
///
22832278
/// For multiple recipients, use `gose/jose/jwe_multi`.
2284-
pub fn serialize_json_flattened(
2285-
jwe: Jwe(Encrypted, family, Built),
2286-
) -> json.Json {
2279+
pub fn serialize_json_flattened(jwe: Jwe(Encrypted, family, Built)) -> json.Json {
22872280
let assert EncryptedJwe(
22882281
protected_b64:,
22892282
encrypted_key:,

src/gose/jose/jwk.gleam

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,7 @@ fn thumbprint_json(k: key.Key(kid)) -> Result(String, gose.GoseError) {
10651065
<> "\"}",
10661066
)
10671067
}
1068-
key.Rsa(key.RsaPrivate(public:, ..))
1069-
| key.Rsa(key.RsaPublic(key: public)) -> {
1068+
key.Rsa(key.RsaPrivate(public:, ..)) | key.Rsa(key.RsaPublic(key: public)) -> {
10701069
let e =
10711070
rsa.public_key_exponent_bytes(public)
10721071
|> utils.strip_leading_zeros

src/gose/jose/jws.gleam

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,7 @@ pub fn verifier(
265265
}
266266

267267
/// Set the content type (cty) header parameter.
268-
pub fn with_cty(
269-
jws: Jws(Unsigned, Built),
270-
cty: String,
271-
) -> Jws(Unsigned, Built) {
268+
pub fn with_cty(jws: Jws(Unsigned, Built), cty: String) -> Jws(Unsigned, Built) {
272269
map_unsigned_header(jws, fn(h) { JwsHeader(..h, cty: option.Some(cty)) })
273270
}
274271

@@ -319,18 +316,12 @@ pub fn with_header(
319316
}
320317

321318
/// Set the key ID (kid) header parameter.
322-
pub fn with_kid(
323-
jws: Jws(Unsigned, Built),
324-
kid: String,
325-
) -> Jws(Unsigned, Built) {
319+
pub fn with_kid(jws: Jws(Unsigned, Built), kid: String) -> Jws(Unsigned, Built) {
326320
map_unsigned_header(jws, fn(h) { JwsHeader(..h, kid: option.Some(kid)) })
327321
}
328322

329323
/// Set the type (typ) header parameter (e.g., "JWT").
330-
pub fn with_typ(
331-
jws: Jws(Unsigned, Built),
332-
typ: String,
333-
) -> Jws(Unsigned, Built) {
324+
pub fn with_typ(jws: Jws(Unsigned, Built), typ: String) -> Jws(Unsigned, Built) {
334325
map_unsigned_header(jws, fn(h) { JwsHeader(..h, typ: option.Some(typ)) })
335326
}
336327

src/gose/jose/jwt.gleam

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,7 @@ pub fn verify_and_validate(
550550
Ok(jwt)
551551
}
552552

553-
fn parse_jws(
554-
token: String,
555-
) -> Result(jws.Jws(jws.Signed, jws.Parsed), JwtError) {
553+
fn parse_jws(token: String) -> Result(jws.Jws(jws.Signed, jws.Parsed), JwtError) {
556554
jws.parse_compact(token)
557555
|> result.map_error(gose_error_to_malformed_token_error)
558556
}

src/gose/key.gleam

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ pub fn material_octet_secret(
187187
}
188188

189189
@internal
190-
pub fn material_rsa(
191-
mat: KeyMaterial,
192-
) -> Result(RsaKeyMaterial, gose.GoseError) {
190+
pub fn material_rsa(mat: KeyMaterial) -> Result(RsaKeyMaterial, gose.GoseError) {
193191
case mat {
194192
Rsa(rsa) -> Ok(rsa)
195193
OctetKey(..) | Ec(..) | Eddsa(..) | Xdh(..) ->
@@ -218,9 +216,7 @@ pub fn material_eddsa(
218216
}
219217

220218
@internal
221-
pub fn material_xdh(
222-
mat: KeyMaterial,
223-
) -> Result(XdhKeyMaterial, gose.GoseError) {
219+
pub fn material_xdh(mat: KeyMaterial) -> Result(XdhKeyMaterial, gose.GoseError) {
224220
case mat {
225221
Xdh(xdh) -> Ok(xdh)
226222
OctetKey(..) | Rsa(..) | Ec(..) | Eddsa(..) ->
@@ -266,9 +262,7 @@ fn eddsa_public_key_internal(public: eddsa.PublicKey) -> Key(kid) {
266262
new_key(Eddsa(EddsaPublic(key: public, curve:)))
267263
}
268264

269-
fn rsa_private_key_internal(
270-
pair: #(rsa.PrivateKey, rsa.PublicKey),
271-
) -> Key(kid) {
265+
fn rsa_private_key_internal(pair: #(rsa.PrivateKey, rsa.PublicKey)) -> Key(kid) {
272266
let #(private, public) = pair
273267
new_key(Rsa(RsaPrivate(key: private, public:)))
274268
}

0 commit comments

Comments
 (0)