permissionless
Version:
A utility library for working with ERC-4337
20 lines • 758 B
JavaScript
export const getCredentials = async (client, args) => {
const response = await client.request({
method: "pks_getCredentials",
params: [args?.context]
});
if (!Array.isArray(response)) {
throw new Error("Invalid response from server - expected array");
}
for (const passkey of response) {
if (typeof passkey?.id !== "string") {
throw new Error("Invalid passkey id returned from server");
}
if (typeof passkey?.publicKey !== "string" ||
!passkey.publicKey.startsWith("0x")) {
throw new Error("Invalid public key returned from server - must be hex string starting with 0x");
}
}
return response;
};
//# sourceMappingURL=getCredentials.js.map