How to write OP_CHECKMULTISIG for the following 1-of-2 multisig P2SH script OP_IF
  OP_SHA256
  &lt;hash of secret&gt;
  OP_EQUALVERIFY
  &lt;pubKey of swap&gt;
  OP_CHECKSIG
OP_ELSE
  &lt;relative locktime&gt;
  OP_CHECKSEQUENCEVERIFY
  OP_DROP
  &lt;pubKey of refund&gt;
  OP_CHECKSIG
OP_ENDIF


Actual code which i am using for the above script is 

const script = this.app.env.bitcoin.script.compile([
      hashOpcode,
      Buffer.from(secretHash, "hex"),
      this.app.env.bitcoin.opcodes.OP_EQUALVERIFY,
     Buffer.from(recipientPublicKey, "hex"),
      this.app.env.bitcoin.opcodes.OP_EQUAL,
      this.app.env.bitcoin.opcodes.OP_IF,                   
      Buffer.from(recipientPublicKey, "hex"),
      this.app.env.bitcoin.opcodes.OP_CHECKSIG,
     this.app.env.bitcoin.opcodes.OP_ELSE,
    this.app.env.bitcoin.script.number.encode(lockTime),
      this.app.env.bitcoin.opcodes.OP_CHECKSEQUENCEVERIFY,
      this.app.env.bitcoin.opcodes.OP_DROP,
      Buffer.from(ownerPublicKey, "hex"),
      this.app.env.bitcoin.opcodes.OP_CHECKSIG,
      this.app.env.bitcoin.opcodes.OP_ENDIF
    ]);


As we see that this script has just one  public key(pubKey of swap) to sign with. But i want to sign it with two public keys.
I searched for it but found nothing, can anybody guide me?

I just want to follow this pattern

 OP_0 [Sig 1] OP_1 [PK 1][PK 2] OP_2 OP_CHECKMULTISIG
From what I understand from your question (correct me if I'm wrong), you want to have a script that in the OP_IF part pays to 1-of-2 public keys. You could try the below script:

OP_IF
  OP_SHA256
  OP_DATA (0x20)
  &lt;hash of secret&gt;
  OP_EQUALVERIFY
  OP_1 
  OP_DATA (0x21) 
  &lt;pubKey of swap1&gt;
  OP_DATA (0x21)
  &lt;pubkey of swap2&gt;
  OP_2
  OP_CHECKMULTISIG
OP_ELSE
  OP_DATA (size of relative_locktime)
  &lt;relative locktime&gt;
  OP_CHECKSEQUENCEVERIFY
  OP_DROP
  OP_DATA (0x21)
  &lt;pubKey of refund&gt;
  OP_CHECKSIG
OP_ENDIF


You could spend this script with: &lt;0&gt; &lt;sig1&gt; &lt;secret&gt; 1