Skip to content

Commit

Permalink
*: Support Neo N3 auth scheme
Browse files Browse the repository at this point in the history
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 <leonard@morphbits.io>
  • Loading branch information
cthulhu-rider committed Feb 27, 2025
1 parent e8a60dd commit 491ab6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions proto-docs/refs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |


Expand Down Expand Up @@ -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. |


<!-- end enums -->
Expand Down
8 changes: 6 additions & 2 deletions refs/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -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.
Expand Down

0 comments on commit 491ab6b

Please sign in to comment.