Skip to content

Commit f65e95b

Browse files
committed
chore: update gleam to 1.16
1 parent 182d509 commit f65e95b

14 files changed

Lines changed: 76 additions & 25 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: erlef/setup-beam@v1
1616
with:
1717
otp-version: "28"
18-
gleam-version: "1.15.4"
18+
gleam-version: "1.16"
1919
rebar3-version: "3"
2020
- run: gleam deps download
2121
- run: gleam format --check src test
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
matrix:
2828
otp-version: ["27", "28"]
29-
gleam-version: ["1.14.0", "1.15.4"]
29+
gleam-version: ["1.15", "1.16"]
3030
steps:
3131
- uses: actions/checkout@v6
3232
- uses: erlef/setup-beam@v1
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
matrix:
4545
node-version: ["22", "24"]
46-
gleam-version: ["1.14.0", "1.15.4"]
46+
gleam-version: ["1.15", "1.16"]
4747
steps:
4848
- uses: actions/checkout@v6
4949
- uses: actions/setup-node@v6

src/gose.gleam

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,9 @@ fn eddsa_public_key_internal(public: eddsa.PublicKey) -> Key(kid) {
452452
new_key(Edwards(EddsaPublic(key: public, curve:)))
453453
}
454454

455-
fn rsa_private_key_internal(pair: #(rsa.PrivateKey, rsa.PublicKey)) -> Key(kid) {
455+
fn rsa_private_key_internal(
456+
pair: #(rsa.PrivateKey, rsa.PublicKey),
457+
) -> Key(kid) {
456458
let #(private, public) = pair
457459
new_key(Rsa(RsaPrivate(key: private, public:)))
458460
}
@@ -819,7 +821,10 @@ pub fn with_key_ops(
819821
/// the specified use, or if the use is incompatible with the key type per RFC
820822
/// 8037 (EdDSA keys can only be used for signing, XDH keys can only be used for
821823
/// encryption).
822-
pub fn with_key_use(key: Key(kid), use_: KeyUse) -> Result(Key(kid), GoseError) {
824+
pub fn with_key_use(
825+
key: Key(kid),
826+
use_: KeyUse,
827+
) -> Result(Key(kid), GoseError) {
823828
use _ <- result.try(validate_key_use_ops(option.Some(use_), key.key_ops))
824829
use _ <- result.try(validate_rfc8037_key_use(key.material, option.Some(use_)))
825830
Ok(Key(..key, key_use: option.Some(use_)))

src/gose/cose.gleam

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ pub fn headers_from_cbor(
165165
}
166166

167167
@internal
168-
pub fn headers_to_cbor(headers: List(Header)) -> List(#(cbor.Value, cbor.Value)) {
168+
pub fn headers_to_cbor(
169+
headers: List(Header),
170+
) -> List(#(cbor.Value, cbor.Value)) {
169171
list.map(headers, header_to_cbor)
170172
}
171173

@@ -943,7 +945,9 @@ pub fn signing_alg_to_int(alg: gose.SigningAlg) -> Int {
943945
}
944946

945947
/// Parse a signing algorithm from its COSE integer identifier.
946-
pub fn signing_alg_from_int(id: Int) -> Result(gose.SigningAlg, gose.GoseError) {
948+
pub fn signing_alg_from_int(
949+
id: Int,
950+
) -> Result(gose.SigningAlg, gose.GoseError) {
947951
case signature_alg_from_int(id) {
948952
Ok(alg) -> Ok(gose.DigitalSignature(alg))
949953
Error(_) ->
@@ -1033,7 +1037,9 @@ pub fn content_alg_to_int(alg: gose.ContentAlg) -> Result(Int, gose.GoseError) {
10331037
}
10341038

10351039
/// Parse a content encryption algorithm from its COSE integer identifier.
1036-
pub fn content_alg_from_int(id: Int) -> Result(gose.ContentAlg, gose.GoseError) {
1040+
pub fn content_alg_from_int(
1041+
id: Int,
1042+
) -> Result(gose.ContentAlg, gose.GoseError) {
10371043
case id {
10381044
1 -> Ok(gose.AesGcm(gose.Aes128))
10391045
2 -> Ok(gose.AesGcm(gose.Aes192))

src/gose/cose/algorithm.gleam

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ pub fn signing_alg_to_int(alg: gose.SigningAlg) -> Int {
3535
}
3636

3737
@deprecated("use gose/cose.signing_alg_from_int")
38-
pub fn signing_alg_from_int(id: Int) -> Result(gose.SigningAlg, gose.GoseError) {
38+
pub fn signing_alg_from_int(
39+
id: Int,
40+
) -> Result(gose.SigningAlg, gose.GoseError) {
3941
cose.signing_alg_from_int(id)
4042
}
4143

@@ -59,6 +61,8 @@ pub fn content_alg_to_int(alg: gose.ContentAlg) -> Result(Int, gose.GoseError) {
5961
}
6062

6163
@deprecated("use gose/cose.content_alg_from_int")
62-
pub fn content_alg_from_int(id: Int) -> Result(gose.ContentAlg, gose.GoseError) {
64+
pub fn content_alg_from_int(
65+
id: Int,
66+
) -> Result(gose.ContentAlg, gose.GoseError) {
6367
cose.content_alg_from_int(id)
6468
}

src/gose/cose/encrypt.gleam

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ pub opaque type Decryptor {
127127
}
128128

129129
/// Create a new COSE_Encrypt message with the given content encryption algorithm.
130-
pub fn new(enc: gose.ContentAlg) -> Result(Encrypt(Unencrypted), gose.GoseError) {
130+
pub fn new(
131+
enc: gose.ContentAlg,
132+
) -> Result(Encrypt(Unencrypted), gose.GoseError) {
131133
use alg_id <- result.try(cose.content_alg_to_int(enc))
132134
Ok(
133135
UnencryptedEncrypt(

src/gose/cose/sign1.gleam

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

282282
/// Set external additional authenticated data (AAD) for the signing operation.
283-
pub fn with_aad(message: Sign1(Unsigned), aad aad: BitArray) -> Sign1(Unsigned) {
283+
pub fn with_aad(
284+
message: Sign1(Unsigned),
285+
aad aad: BitArray,
286+
) -> Sign1(Unsigned) {
284287
let assert UnsignedSign1(..) = message
285288
UnsignedSign1(..message, aad:)
286289
}
287290

288291
/// Add a key ID to the unprotected headers.
289-
pub fn with_kid(message: Sign1(Unsigned), kid kid: BitArray) -> Sign1(Unsigned) {
292+
pub fn with_kid(
293+
message: Sign1(Unsigned),
294+
kid kid: BitArray,
295+
) -> Sign1(Unsigned) {
290296
let assert UnsignedSign1(unprotected:, ..) = message
291297
UnsignedSign1(..message, unprotected: [cose.Kid(kid), ..unprotected])
292298
}
@@ -359,7 +365,9 @@ fn build_sig_structure(
359365
)
360366
}
361367

362-
fn parse_cbor_value(value: cbor.Value) -> Result(Sign1(Signed), gose.GoseError) {
368+
fn parse_cbor_value(
369+
value: cbor.Value,
370+
) -> Result(Sign1(Signed), gose.GoseError) {
363371
use items <- result.try(cose_structure.parse_cose_array_value(
364372
value,
365373
expected_tag: 18,

src/gose/internal/key_extract.gleam

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub fn rsa_private_key(
1313
}
1414
}
1515

16-
pub fn rsa_public_key(material: gose.KeyMaterial) -> Result(rsa.PublicKey, Nil) {
16+
pub fn rsa_public_key(
17+
material: gose.KeyMaterial,
18+
) -> Result(rsa.PublicKey, Nil) {
1719
case material {
1820
gose.Rsa(gose.RsaPrivate(public:, ..)) -> Ok(public)
1921
gose.Rsa(gose.RsaPublic(key: public)) -> Ok(public)

src/gose/internal/signing.gleam

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ fn resolve_ecdsa_params(alg: gose.EcdsaAlg) -> #(hash.HashAlgorithm, ec.Curve) {
169169
}
170170
}
171171

172-
fn resolve_hmac_params(alg: gose.HmacAlg) -> #(hash.HashAlgorithm, Int, String) {
172+
fn resolve_hmac_params(
173+
alg: gose.HmacAlg,
174+
) -> #(hash.HashAlgorithm, Int, String) {
173175
case alg {
174176
gose.HmacSha256 -> #(hash.Sha256, 32, "HS256")
175177
gose.HmacSha384 -> #(hash.Sha384, 48, "HS384")

src/gose/internal/utils.gleam

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ pub fn ec_curve_to_string(curve: ec.Curve) -> String {
4141
}
4242

4343
/// Parse an EdDSA curve from its JWK string representation.
44-
pub fn eddsa_curve_from_string(s: String) -> Result(eddsa.Curve, gose.GoseError) {
44+
pub fn eddsa_curve_from_string(
45+
s: String,
46+
) -> Result(eddsa.Curve, gose.GoseError) {
4547
case s {
4648
"Ed25519" -> Ok(eddsa.Ed25519)
4749
"Ed448" -> Ok(eddsa.Ed448)

src/gose/jose/jwe.gleam

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,10 @@ fn try_keys(
15471547
}
15481548
}
15491549

1550-
fn header_to_json(header: JweHeader, alg_fields: ResolvedAlgFields) -> BitArray {
1550+
fn header_to_json(
1551+
header: JweHeader,
1552+
alg_fields: ResolvedAlgFields,
1553+
) -> BitArray {
15511554
let alg_field = #(
15521555
"alg",
15531556
json.string(jose.key_encryption_alg_to_string(header.alg)),
@@ -2258,7 +2261,9 @@ fn parse_optional_base64(
22582261
/// When unprotected headers are present, includes the `unprotected` and/or `header` fields.
22592262
///
22602263
/// For multiple recipients, use `gose/jose/jwe_multi`.
2261-
pub fn serialize_json_flattened(jwe: Jwe(Encrypted, family, Built)) -> json.Json {
2264+
pub fn serialize_json_flattened(
2265+
jwe: Jwe(Encrypted, family, Built),
2266+
) -> json.Json {
22622267
let assert EncryptedJwe(
22632268
protected_b64:,
22642269
encrypted_key:,

0 commit comments

Comments
 (0)