From 491ab6b5ed8ddd7a20fdb047c517d51359d6892e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 27 Feb 2025 14:26:44 +0300 Subject: [PATCH] *: Support Neo N3 auth scheme This adds new `refs.SignatureScheme` enum value making any `refs.Signature` field work as N3 witness. This feature will allow authentication and authorization with multi-signatures and contract-based accounts. Closes #305. Signed-off-by: Leonard Lyubich --- proto-docs/refs.md | 5 +++-- refs/types.proto | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/proto-docs/refs.md b/proto-docs/refs.md index 27222e0..6fc9840 100644 --- a/proto-docs/refs.md +++ b/proto-docs/refs.md @@ -149,8 +149,8 @@ Signature of something in NeoFS. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| key | [bytes](#bytes) | | Public key used for signing | -| sign | [bytes](#bytes) | | Signature | +| key | [bytes](#bytes) | | Public key used for signing. For N3 `scheme`, the field represents a verification script. | +| sign | [bytes](#bytes) | | Signature. For N3 `scheme`, the field represents an invocation script. | | scheme | [SignatureScheme](#neo.fs.v2.refs.SignatureScheme) | | Scheme contains digital signature scheme identifier | @@ -223,6 +223,7 @@ Signature scheme describes digital signing scheme used for (key, signature) pair | ECDSA_SHA512 | 0 | ECDSA with SHA-512 hashing (FIPS 186-3) | | ECDSA_RFC6979_SHA256 | 1 | Deterministic ECDSA with SHA-256 hashing (RFC 6979) | | ECDSA_RFC6979_SHA256_WALLET_CONNECT | 2 | Deterministic ECDSA with SHA-256 hashing using WalletConnect API. Here the algorithm is the same, but the message format differs. | +| N3 | 3 | Neo N3 witness. | diff --git a/refs/types.proto b/refs/types.proto index 9be849b..6a26990 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -105,9 +105,10 @@ message Version { // Signature of something in NeoFS. message Signature { - // Public key used for signing + // Public key used for signing. For N3 `scheme`, the field represents a + // verification script. bytes key = 1 [json_name = "key"]; - // Signature + // Signature. For N3 `scheme`, the field represents an invocation script. bytes sign = 2 [json_name = "signature"]; // Scheme contains digital signature scheme identifier SignatureScheme scheme = 3 [json_name = "scheme"]; @@ -124,6 +125,9 @@ enum SignatureScheme { // Deterministic ECDSA with SHA-256 hashing using WalletConnect API. // Here the algorithm is the same, but the message format differs. ECDSA_RFC6979_SHA256_WALLET_CONNECT = 2; + + // Neo N3 witness. + N3 = 3; } // RFC 6979 signature.