UNPKG

permissionless

Version:

A utility library for working with ERC-4337

24 lines 902 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCredentials = void 0; 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; }; exports.getCredentials = getCredentials; //# sourceMappingURL=getCredentials.js.map