CrossmintMetamaskDecrypt
Class for decrypting verifiable credentials encrypted with the VerifiableCredentialEncryptionType.CROSSMINT_RECOVERABLE
encryption type using Metamask.
This class uses Metamask to prompt the user to sign a message to decrypt the credential.
If you want to use a different signature method, refer to the CrossmintDecrypt
class.
To use the Crossmint decrypt endpoint, an API key with the credentials.decrypt
scope must be provided.
Constructors
new CrossmintMetamaskDecrypt()
new CrossmintMetamaskDecrypt(
metamask
):CrossmintMetamaskDecrypt
Parameters
Parameter | Type |
---|---|
metamask | MetamaskService |
Returns
Defined in
Methods
decrypt()
decrypt(
credential
,wallet
?):Promise
<VerifiableCredential
>
Decrypts an encrypted verifiable credential using Metamask.
This method prompts the user via Metamask to sign the necessary message for decrypting the credential.
Parameters
Parameter | Type | Description |
---|---|---|
credential | EncryptedVerifiableCredential | The encrypted verifiable credential to decrypt. |
wallet ? | string | (Optional) The user’s wallet address. If not provided, the connected wallet address from Metamask will be used. |
Returns
Promise
<VerifiableCredential
>
A promise that resolves to a VerifiableCredential
.
Throws
Will throw an error if decryption fails or if Metamask is not properly configured.