Members on this page
For(string)GetAccountId(string, ReadOnlySpan<byte>)GetAccountIdCore(string, ReadOnlySpan<byte>)GetChainId(string)MatchesPublicKey(string, ReadOnlySpan<byte>)ValidateAccountId(string)ValidateAccountIdCore(string)VerifySignature(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)VerifySignature(string, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)NamespaceNeo
Meshline.Sdk
Meshline.Identity
AccountAdapter Class
Derives and validates account identifiers and verifies signatures for supported account namespaces.
public abstract class AccountAdapter
Inheritance System.Object → AccountAdapter
Properties
AccountAdapter.Namespace Property
The account namespace handled by this adapter.
protected abstract string Namespace { protected get; }
Property Value
AccountAdapter.Neo Property
The built-in account adapter for the Neo account namespace.
public static Meshline.Identity.AccountAdapter Neo { get; }
Property Value
Methods
AccountAdapter.For(string) Method
Selects the registered adapter for an account namespace, chain identifier, or account identifier.
public static Meshline.Identity.AccountAdapter For(string id);
Parameters
An account namespace, CAIP-2 chain identifier, or CAIP-10 account identifier.
Returns
AccountAdapter
The adapter registered for the identifier's namespace.
Exceptions
System.NotSupportedException
No adapter is registered for the identifier namespace.
AccountAdapter.GetAccountId(string, ReadOnlySpan<byte>) Method
Derives the CAIP-10 account identifier for a chain and account public key.
public static string GetAccountId(string chainId, System.ReadOnlySpan<byte> publicKey);
Parameters
chainId System.String
The CAIP-2 chain identifier whose account address should be derived.
publicKey System.ReadOnlySpan<System.Byte>
The public key in the encoding required by the identity's signature algorithm.
Returns
System.String
The account's canonical CAIP-10 identifier.
Exceptions
System.NotSupportedException
The account or chain identifier uses an unsupported namespace.
System.FormatException
The chain or account identifier is malformed, or the public key is not a valid compressed Neo N3 P-256 key.
AccountAdapter.GetAccountIdCore(string, ReadOnlySpan<byte>) Method
Derives an account identifier using this adapter's chain-specific address rules.
protected abstract string GetAccountIdCore(string chainId, System.ReadOnlySpan<byte> publicKey);
Parameters
chainId System.String
The CAIP-2 chain identifier whose account address should be derived.
publicKey System.ReadOnlySpan<System.Byte>
The public key in the encoding required by the identity's signature algorithm.
Returns
System.String
The derived account identifier in the adapter's namespace.
Exceptions
System.FormatException
The chain or account identifier is malformed, or the public key is not a valid compressed Neo N3 P-256 key.
AccountAdapter.GetChainId(string) Method
Extracts the CAIP-2 chain identifier from a syntactically valid CAIP-10 account identifier.
public static string GetChainId(string accountId);
Parameters
accountId System.String
The account's CAIP-10 identifier.
Returns
System.String
The chain portion of the supplied account identifier.
Exceptions
System.FormatException
The input is not a syntactically valid CAIP-10 account identifier.
AccountAdapter.MatchesPublicKey(string, ReadOnlySpan<byte>) Method
Determines whether a public key derives the supplied account identifier.
public static bool MatchesPublicKey(string accountId, System.ReadOnlySpan<byte> publicKey);
Parameters
accountId System.String
The account's CAIP-10 identifier.
publicKey System.ReadOnlySpan<System.Byte>
The public key in the encoding required by the identity's signature algorithm.
Returns
System.Boolean
true if the public key derives the account identifier; otherwise, false.
Exceptions
System.NotSupportedException
The account or chain identifier uses an unsupported namespace.
System.FormatException
The chain or account identifier is malformed, or the public key is not a valid compressed Neo N3 P-256 key.
AccountAdapter.ValidateAccountId(string) Method
Validates the account identifier using the adapter selected by its namespace.
public static Meshline.Validation.ProtocolViolation? ValidateAccountId(string accountId);
Parameters
accountId System.String
The account's CAIP-10 identifier.
Returns
ProtocolViolation
The first detected protocol violation, or null if the implemented checks pass.
Exceptions
System.NotSupportedException
The account or chain identifier uses an unsupported namespace.
AccountAdapter.ValidateAccountIdCore(string) Method
Validates an account identifier using this adapter's chain-specific address rules.
protected abstract Meshline.Validation.ProtocolViolation? ValidateAccountIdCore(string accountId);
Parameters
accountId System.String
The account's CAIP-10 identifier.
Returns
ProtocolViolation
The first detected protocol violation, or null if the implemented checks pass.
AccountAdapter.VerifySignature(string, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>) Method
Verifies the signature and its binding to the supplied identity.
public static bool VerifySignature(string accountId, System.ReadOnlySpan<byte> publicKey, System.ReadOnlySpan<byte> data, System.ReadOnlySpan<byte> signature);
Parameters
accountId System.String
The account's CAIP-10 identifier.
publicKey System.ReadOnlySpan<System.Byte>
The public key in the encoding required by the identity's signature algorithm.
data System.ReadOnlySpan<System.Byte>
The exact bytes to sign or verify.
signature System.ReadOnlySpan<System.Byte>
The signature bytes to verify against the supplied input.
Returns
System.Boolean
true if the signature is valid and the public key matches the supplied identifier; otherwise, false.
Exceptions
System.NotSupportedException
The account or chain identifier uses an unsupported namespace.
System.Security.Cryptography.CryptographicException
The cryptographic provider cannot create or use the P-256 signature verifier; an invalid signature normally returns false.
AccountAdapter.VerifySignature(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>) Method
Verifies the signature using the public key and identity algorithm.
public abstract bool VerifySignature(System.ReadOnlySpan<byte> publicKey, System.ReadOnlySpan<byte> data, System.ReadOnlySpan<byte> signature);
Parameters
publicKey System.ReadOnlySpan<System.Byte>
The public key in the encoding required by the identity's signature algorithm.
data System.ReadOnlySpan<System.Byte>
The exact bytes to sign or verify.
signature System.ReadOnlySpan<System.Byte>
The signature bytes to verify against the supplied input.
Returns
System.Boolean
true if the signature is valid; otherwise, false.
Exceptions
System.Security.Cryptography.CryptographicException
The cryptographic provider cannot create or use the P-256 signature verifier; an invalid signature normally returns false.