Skip to content

Commit 2f4c19d

Browse files
sivo4kinanhthii
authored andcommitted
feat: enhance authorization configuration with new signature algorithms and backward compatibility
1 parent 7cc696b commit 2f4c19d

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

pkg/identity/identity.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,33 @@ type InitiatorKey struct {
6161
P256 *ecdsa.PublicKey
6262
}
6363

64+
// SignatureAlgorithm represents supported signature algorithms
65+
type SignatureAlgorithm string
66+
67+
const (
68+
AlgorithmEd25519 SignatureAlgorithm = "ed25519"
69+
AlgorithmP256 SignatureAlgorithm = "p256"
70+
)
71+
6472
// AuthorizerInfo represents a single authorizer with their public key and algorithm
6573
type AuthorizerInfo struct {
66-
PublicKey string `json:"public_key"`
67-
Algorithm string `json:"algorithm"` // "ed25519" or "secp256k1"
74+
PublicKey string `json:"public_key"`
75+
Algorithm SignatureAlgorithm `json:"algorithm"`
6876
}
6977

7078
// AuthorizationConfig holds the cached authorization configuration
7179
type AuthorizationConfig struct {
72-
Enabled bool
73-
RequiredAuthorizers int
74-
AuthorizerPublicKeys map[string]AuthorizerInfo // key is authorizer ID
80+
Enabled bool `mapstructure:"enabled"`
81+
RequiredAuthorizers int `mapstructure:"required_authorizers"`
82+
AuthorizerPublicKeys map[string]AuthorizerInfo `mapstructure:"authorizer_public_keys"`
83+
Authorizers map[string]AuthorizerInfo `mapstructure:"authorizers"` // backward compatibility
84+
}
85+
86+
// AuthorizerConfigEntry represents the raw configuration for an authorizer
87+
type AuthorizerConfigEntry struct {
88+
PublicKey string `mapstructure:"public_key"`
89+
Algorithm string `mapstructure:"algorithm"`
90+
Pubkey string `mapstructure:"pubkey"` // backward compatibility
7591
}
7692

7793
// fileStore implements the Store interface using the filesystem

0 commit comments

Comments
 (0)