{"version":3,"file":"EddsaInterface.mjs","sources":["../../src/EddsaInterface.ts"],"sourcesContent":["import type { Pda, PublicKey } from '@metaplex-foundation/umi-public-keys';\nimport { InterfaceImplementationMissingError } from './errors';\nimport type { Keypair } from './Keypair';\n\n/**\n * Defines the interface for the EdDSA cryptography algorithm.\n * It allows us to create, find and use public keys and keypairs.\n *\n * @category Context and Interfaces\n */\nexport interface EddsaInterface {\n  /** Generates a new keypair. */\n  generateKeypair: () => Keypair;\n  /** Restores a keypair from a secret key. */\n  createKeypairFromSecretKey: (secretKey: Uint8Array) => Keypair;\n  /** Restores a keypair from a seed. */\n  createKeypairFromSeed: (seed: Uint8Array) => Keypair;\n  /** Whether the given public key is on the EdDSA elliptic curve. */\n  isOnCurve: (publicKey: PublicKey) => boolean;\n  /** Finds a Program-Derived Address from the given programId and seeds. */\n  findPda: (programId: PublicKey, seeds: Uint8Array[]) => Pda;\n  /** Signs a message with the given keypair. */\n  sign: (message: Uint8Array, keypair: Keypair) => Uint8Array;\n  /** Verifies a signature for a message with the given public key. */\n  verify: (\n    message: Uint8Array,\n    signature: Uint8Array,\n    publicKey: PublicKey\n  ) => boolean;\n}\n\n/**\n * An implementation of the {@link EddsaInterface} that throws an error when called.\n * @category Signers and PublicKeys\n */\nexport function createNullEddsa(): EddsaInterface {\n  const errorHandler = () => {\n    throw new InterfaceImplementationMissingError('EddsaInterface', 'eddsa');\n  };\n  return {\n    generateKeypair: errorHandler,\n    createKeypairFromSecretKey: errorHandler,\n    createKeypairFromSeed: errorHandler,\n    isOnCurve: errorHandler,\n    findPda: errorHandler,\n    sign: errorHandler,\n    verify: errorHandler,\n  };\n}\n"],"names":["createNullEddsa","errorHandler","InterfaceImplementationMissingError","generateKeypair","createKeypairFromSecretKey","createKeypairFromSeed","isOnCurve","findPda","sign","verify"],"mappings":";;AA+BA;AACA;AACA;AACA;AACO,SAASA,eAAe,GAAmB;EAChD,MAAMC,YAAY,GAAG,MAAM;AACzB,IAAA,MAAM,IAAIC,mCAAmC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;GACzE,CAAA;EACD,OAAO;AACLC,IAAAA,eAAe,EAAEF,YAAY;AAC7BG,IAAAA,0BAA0B,EAAEH,YAAY;AACxCI,IAAAA,qBAAqB,EAAEJ,YAAY;AACnCK,IAAAA,SAAS,EAAEL,YAAY;AACvBM,IAAAA,OAAO,EAAEN,YAAY;AACrBO,IAAAA,IAAI,EAAEP,YAAY;AAClBQ,IAAAA,MAAM,EAAER,YAAAA;GACT,CAAA;AACH;;;;"}