Skip to content

Commit

Permalink
add support for secp256r1 public key literals
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel committed Nov 29, 2024
1 parent 9ad4215 commit 860494a
Show file tree
Hide file tree
Showing 5 changed files with 2,325 additions and 2,206 deletions.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ module.exports = grammar({
origin_clause: $ =>
seq("trusting", $.origin_element, repeat(seq(",", $.origin_element))),
origin_element: $ =>
choice("previous", "authority", seq("ed25519/", repeat1(/[0-9a-f]{2}/))),
choice("previous", "authority", seq($.sig_alg, repeat1(/[0-9a-f]{2}/))),
sig_alg: $ => choice("ed25519/", "secp256r1/"),
comment$ => choice(
$.line_comment,
$.block_comment
Expand Down
17 changes: 15 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,8 @@
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "ed25519/"
"type": "SYMBOL",
"name": "sig_alg"
},
{
"type": "REPEAT1",
Expand All @@ -1226,6 +1226,19 @@
}
]
},
"sig_alg": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "ed25519/"
},
{
"type": "STRING",
"value": "secp256r1/"
}
]
},
"comment": {
"type": "CHOICE",
"members": [
Expand Down
21 changes: 20 additions & 1 deletion src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,17 @@
{
"type": "origin_element",
"named": true,
"fields": {}
"fields": {},
"children": {
"multiple": false,
"required": false,
"types": [
{
"type": "sig_alg",
"named": true
}
]
}
},
{
"type": "param",
Expand Down Expand Up @@ -518,6 +528,11 @@
]
}
},
{
"type": "sig_alg",
"named": true,
"fields": {}
},
{
"type": "source_file",
"named": true,
Expand Down Expand Up @@ -792,6 +807,10 @@
"type": "reject if",
"named": false
},
{
"type": "secp256r1/",
"named": false
},
{
"type": "string",
"named": true
Expand Down
Loading

0 comments on commit 860494a

Please sign in to comment.