I encountered an error while using a library for user authentication. The error message was "Invalid delegation signature error" when attempting to retrieve metadata from an asset. Despite successful authentication, retrieving the data continued to fail due to the signature issue.
Code Snippet
import { useSiweIdentity } from "ic-use-siwe-identity";
import { IcrcLedgerCanister } from "@dfinity/ledger";
import { HttpAgent } from "@dfinity/agent";
import { Principal } from "@dfinity/principal";
function Component() {
const { identity } = useSiweIdentity();
const getTokens = async () => {
const agent = new HttpAgent({
identity,
host: "https://identity.ic0.app",
});
const icpLedger = IcrcLedgerCanister.create({
agent,
canisterId: Principal.fromText("ryjl3-tyaaa-aaaaa-aaaba-cai"),
});
// Fails
const [myMetadata, myTransactionFee] = await Promise.all([
icpLedger.metadata({ certified: false }),
icpLedger.transactionFee({ certified: false }),
]);
};
// ... (rest of the component)
}
Error details
The error message suggests that the public key used to verify the signature is either invalid or incorrect.
Server returned an error:
Code: 403 ()
Body: Failed to authenticate request 0x45ae7cb85d3eae4b4429797a762b4237ad6d2057d6885ec1efb1000223758c8d due to: Invalid delegation: Invalid canister signature: IcCanisterSignature signature could not be verified: public key 0a800000000010000301014881232242ce93f0a8cb485a1b1205eb5e5bf2582774b0aba56f4a1b09c9e857, signature d9d9f7a26b63657274696669636174655901d7d9d9f7a2647472656583018301830183024863616e697374657283018301820458208fcba4e372e153f00389abf562c6bb2c9b90cad286065ebc9021c35a9324a31b830182045820df92c26c079be1a63a3efbe98fc7887240bcbd11656c69a5db5906c0cc7b0ef783024a800000000010000301018301830183024e6365727469666965645f6461746182035820845ef29103a37e0b6af3f780cc5ebf802d9fa242d99a9f59b8a7ee7369cc254182045820143a0e4aad6252d1a0d7ea7c1b2a22a6256dcca514611d6a71e22da7f6d77e1a820458203a61e17e8aaa90401de3e3af8e3838edf867587c7b88daca32a1bc31f88e2f068204582080e96e7561f56e3a75468a853d3b69f102a352b73a0cf43deef462ea99254fe282045820827b20849f1bb50f060ff0559fd1542157fa32cc6b78354c04f1ae206cb8598382045820cb00fc6e3a14d053f1e965671ec69543c7bfdebaa5e058fd02a67bf147074a60830182045820f25f54db70accd747e6dba97dd6a456e39cd3d4304ce4019854374195e8ded8883024474696d65820349a4a8e383d5f2acdc17697369676e617475726558308ea69fd0fb9d32ea06680c12df28369656dbcf1a64bcc6b0fccb3e243ff8e58fc5a85e26ca76bbdab062ef439e7c815d6474726565830182045820d95dda092d572612004d667c45b8af823f31077ba10e1e65c9e63131e4c3f1e0830243736967830258207885657a884d713d80b64490c4d71574b7f64fada9a10c5dc076fb3ea419cde4830258202a3c7bbe8d502ec298fd4b2fa72c7062c58af9af9f78ce2fb66c71526466e757820340, error: certificate verification failed: failed to verify threshold signature: certificate_tree_hash=CryptoHash(0x0703cf8a02e85d5c67f4c75050a57b770e53369fcb7040486c6029180c92a449), sig=Blob{48 bytes;8ea69fd0fb9d32ea06680c12df28369656dbcf1a64bcc6b0fccb3e243ff8e58fc5a85e26ca76bbdab062ef439e7c815d}, pk=ThresholdSigPublicKey { internal: ThresBls12_381(0x814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae) }, error=ThresBls12_381 signature could not be verified: public key 814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae, signature 8ea69fd0fb9d32ea06680c12df28369656dbcf1a64bcc6b0fccb3e243ff8e58fc5a85e26ca76bbdab062ef439e7c815d, error: Invalid combined threshold signature
Retrying request.
Summary
I encountered an error while using a library for user authentication. The error message was "Invalid delegation signature error" when attempting to retrieve metadata from an asset. Despite successful authentication, retrieving the data continued to fail due to the signature issue.
Code Snippet
Error details
The error message suggests that the public key used to verify the signature is either invalid or incorrect.