Signing A Message
Overview
Providers, if supported, can sign an arbitrary UTF-8 string.
Signing a message
- Javascript
- TypeScript
// initialized client
client.onSignMessage(({ error, result }) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
{
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
signature: 'gqNzaWfEQ...',
signer: 'P3AIQVDJ2CTH54KSJE63YWB7IZGS4W4JGC53I6GK72BGZ5BXO2B2PS4M4U',
}
*/
});
// send a sign message request
client.signMessage({
message: 'Hello humie!',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
signer: 'P3AIQVDJ2CTH54KSJE63YWB7IZGS4W4JGC53I6GK72BGZ5BXO2B2PS4M4U',
});
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
// initialized client
client.onSignMessage(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
{
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
signature: 'gqNzaWfEQ...',
signer: 'P3AIQVDJ2CTH54KSJE63YWB7IZGS4W4JGC53I6GK72BGZ5BXO2B2PS4M4U',
}
*/
});
// send a sign message request
client.signMessage({
message: 'Hello humie!',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
signer: 'P3AIQVDJ2CTH54KSJE63YWB7IZGS4W4JGC53I6GK72BGZ5BXO2B2PS4M4U',
});
caution
If this method is not supported, then a MethodNotSupportedError
will be sent in the error
parameter.
caution
If the signer is not known, or not authorized, then a UnauthorizedSignerError
will be sent in the error
parameter.