@openforge-sh/liboqs - v0.14.3
    Preparing search index...

    Class Falcon1024

    Falcon-1024 signature algorithm wrapper class

    Falcon1024

    High-level wrapper for Falcon-1024 signature operations. Provides secure key generation, message signing, and signature verification with automatic memory management.

    Memory Management:

    • All WASM memory is managed internally
    • Call destroy() when finished to free resources
    • Do not use instance after calling destroy()
    const sig = await createFalcon1024();

    // Generate keypair
    const { publicKey, secretKey } = sig.generateKeyPair();

    // Sign message
    const message = new TextEncoder().encode('Hello, quantum world!');
    const signature = sig.sign(message, secretKey);

    // Verify signature
    const isValid = sig.verify(message, signature, publicKey);
    console.log('Valid:', isValid); // true

    // Cleanup
    sig.destroy();
    Index

    Accessors

    • get info(): {
          name: "Falcon-1024";
          identifier: "Falcon-1024";
          type: "sig";
          securityLevel: 5;
          standardized: false;
          description: string;
          keySize: { publicKey: 1793; secretKey: 2305; signature: 1462 };
      }

      Get algorithm information

      Returns {
          name: "Falcon-1024";
          identifier: "Falcon-1024";
          type: "sig";
          securityLevel: 5;
          standardized: false;
          description: string;
          keySize: { publicKey: 1793; secretKey: 2305; signature: 1462 };
      }

      Algorithm metadata

      console.log(sig.info.name);           // 'Falcon-1024'
      console.log(sig.info.securityLevel); // 5
      console.log(sig.info.keySize); // { publicKey: 1793, secretKey: 2305, signature: 1462 }

    Methods

    • Generate a new Falcon-1024 keypair

      Returns { publicKey: Uint8Array; secretKey: Uint8Array }

      If instance is destroyed

      If key generation fails

      const { publicKey, secretKey } = sig.generateKeyPair();
      console.log('Public key:', publicKey.length); // 1793 bytes
      console.log('Secret key:', secretKey.length); // 2305 bytes
    • Sign a message with Falcon-1024

      Parameters

      • message: Uint8Array<ArrayBufferLike>

        Message to sign (any length)

      • secretKey: Uint8Array<ArrayBufferLike>

        Secret key (2305 bytes)

      Returns Uint8Array<ArrayBufferLike>

      Signature (variable length, max 1462 bytes)

      If instance is destroyed

      If secret key size is invalid

      If signing fails

      const message = new TextEncoder().encode('Sign this message');
      const signature = sig.sign(message, secretKey);
      console.log('Signature length:', signature.length); // ~1462 bytes (variable)
    • Verify a Falcon-1024 signature

      Parameters

      • message: Uint8Array<ArrayBufferLike>

        Original message

      • signature: Uint8Array<ArrayBufferLike>

        Signature to verify

      • publicKey: Uint8Array<ArrayBufferLike>

        Public key (1793 bytes)

      Returns boolean

      True if signature is valid, false otherwise

      If instance is destroyed

      If public key or signature size is invalid

      const isValid = sig.verify(message, signature, publicKey);
      if (isValid) {
      console.log('Signature is valid!');
      } else {
      console.log('Signature verification failed');
      }
    • Free WASM resources

      Returns void

      Releases all WASM memory associated with this instance. The instance cannot be used after calling destroy().

      sig.destroy();
      // sig is now unusable