Identify Snap connects to your currently connected Metamask account by default. To learn how apps can connect to Identify Snap using a non-metamask(external) account, refer to this documentation.
Then, depending on whether you're trying to connect to a metamask account or a non-metamask account, you can call the snap API in the following way:
const snapId = `npm:@hashgraph/hedera-identify-snap`
const externalAccountParams = {
externalAccount: {
accountIdOrEvmAddress: '0.0.12345',
curve: 'ED25519'
}
}
const id = ['9c81cabf-ef8e-4223-9987-a1c25773bece']
const options = {
// If you want to remove the VCs from multiple stores, you can pass an
// array like so:
// store: ['snap', 'googleDrive']
store: ['snap']
}
const metamaskAddress = '0x2e5fF0267b678A0FAF9A9f5b0FBf7Ac9638B5b57'
const params = {
metamaskAddress,
id,
options
/*
Uncomment the below line if you want to connect to a non-metamask account
*/
// ...externalAccountParams
}
const handleRemoveVCAPI = async () => {
await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: {
method: 'removeVC',
params: params
}
}
})
}
Notes:
There is no need to pass in options
if you want to store the VC in the Metamask snap state as this is the default behavior however, for storing it in googleDrive
, you will need to specify via this parameter. In order to use googleDrive
, you first need to first configure your google account.
If you want to remove the same VC from multiple stores, you can pass in an array for options.store
.
Retrieves the currently connected account and the blockchain network the user has selected on Metamask. If it's the first time, the account info is also saved in snap state.
Removes the Verifiable Credentials(VCs) for the specified VC Ids.
Returns the result that includes which VC Ids were removed along with the store from which they were removed from.
Some example responses:
[
{
"id": "9c81cabf-ef8e-4223-9987-a1c25773bece",
"removed": true,
"store": "snap"
}
]