Interface
AuthDataService
On this page
A utility class that is responsible for keeping track of authorization details. Such as what operations there is, what they require in terms of privileges and selecting the correct auth descriptor for authorizing an operation.
interface AuthDataService {
connection: Connection;
getAllowedAuthDescriptor(
operation: Operation,
accountId: BufferId,
adIds: BufferId[],
): Promise<Buffer<ArrayBufferLike> | null>;
getAuthDescriptorCounter(
accountId: BufferId,
authDescriptorId: BufferId,
): Promise<number | null>;
getAuthHandlerForOperation(
operationName: string,
): Promise<AuthHandler | null>;
getAuthMessageTemplate(
operation: RellOperation | Operation,
): Promise<string>;
getBlockchainRid(): Buffer;
getLoginConfig(name?: string): Promise<LoginConfig>;
}Properties
connection
connection: ConnectionMethods
getAllowedAuthDescriptor
getAllowedAuthDescriptor( operation: Operation, accountId: BufferId, adIds: BufferId[], ): Promise<Buffer<ArrayBufferLike> | null>Selects an auth descriptor from a list of auth descriptors which will be allowed to authorize the specified operation
Parameters
- operation: Operation
the operation that is being authorized
- accountId: BufferId
the account for which the operation is being authorized
- adIds: BufferId[]
a list of auth descriptor ids to select from
Returns Promise<Buffer<ArrayBufferLike> | null>
first auth descriptor id from the provided list that will be allowed to authorize the operation, or null if none of the provided auth descriptors would be allowed.
- operation: Operation
getAuthDescriptorCounter
getAuthDescriptorCounter( accountId: BufferId, authDescriptorId: BufferId, ): Promise<number | null>Fetches the current counter value for an auth descriptor when authorizing against a certain account.
Parameters
- accountId: BufferId
the account id to authorize against
- authDescriptorId: BufferId
the auth descriptor to get the counter for
Returns Promise<number | null>
current counter value, or null if none was found
Remarks
if more than one operation is performed with this auth descriptor on this account in the same transaction, then this counter has to be manually increased after the first operation
- accountId: BufferId
getAuthHandlerForOperation
getAuthHandlerForOperation(operationName: string): Promise<AuthHandler | null>Retrieves the auth handler that is defined for the operation with the provided name. If the operation does not have an auth handler specified, null is returned
Parameters
- operationName: string
the name of the operation to get the auth handler for
Returns Promise<AuthHandler | null>
- operationName: string
getAuthMessageTemplate
getAuthMessageTemplate(operation: RellOperation | Operation): Promise<string>Returns the auth message template to use when signing a specified operation.
Parameters
- operation: RellOperation | Operation
the operation to get the message for
Returns Promise<string>
- operation: RellOperation | Operation
getBlockchainRid
getBlockchainRid(): BufferReturns the blockchain rid to which this auth data service is configured.
Returns Buffer
getLoginConfig
getLoginConfig(name?: string): Promise<LoginConfig>Retrieves the login config for a specific config name. If no name is provided, the default login config will be used.
Parameters
Optionalname: stringthe name of the login config
Returns Promise<LoginConfig>