> For the complete documentation index, see [llms.txt](https://docs.0xpass.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.0xpass.io/programmability/lambda-functions/create-lambda/create-lambda-sdk.md).

# Create Lambda SDK

To register a lambda, a user  / an account would need to have to have been created ( [Registration](/authentication/passkeys/registration.md)) and have an associated session by going through the [Authenticating with SDK](/authentication/passkeys/authentication/authenticating-with-sdk.md) flow. Once you have the required details you can call the sign method by instantiating a Passport instance from the SDK as shown below.

```javascript
import { Passport } from "@0xpass/passport";
import { WebauthnSigner } from "@0xpass/webauthn-signer";

const signer = new WebauthnSigner({
      rpId: window.location.hostname,
      rpName: "rpName",
});

const passport = new Passport({
    scopeId: "insert_your_scope_id",
    signer: signer
});


const userInput {
   username: "insert_username_here"
   userDisplayName: "insert_user_display_name_here"
}

await passport.setupEncryption(); 
await passport.authenticate(userInput);

const config = {
    "authorization": {
        "type": "none"
    },
    "verifications": {
        "count": 1
    },
    "triggers": [
       { "type": "hook"},
    ],
    "envs": [],
    "max_executions": 0,
    "conditions": [
        {
            "type": "code",
            "code": "if (Math.random() < 0.5) { return true; } else { return false; }",
            "output_type": "integer",
            "substitution": true
        }
    ],
    "actions": {
        "type": "personal_sign",
        "check": "",
        "data": "0x000000",
        "substitution": true
    },
    "postHook": []
}

// Generate a threshold signature
const lambda_uuid = await passport.createLambda({data:config});
console.log(lambda_uuid);
```

### createLambda Parameters

<table><thead><tr><th>Parameter</th><th>Description</th><th>Example Values</th></tr></thead><tbody><tr><td><code>data</code></td><td>Refer to <a href="/pages/wAckqo6WfxFU2S4vEPbE">Full Spec</a> for more info.</td><td><pre class="language-json"><code class="lang-json">{
    "authorization": {
        "type": "none"
    },
    "verifications": {
        "count": 1
    },
    "envs": [],
    "max_executions": 0,
    "conditions": [
        {
            "type": "code",
            "code": "if (Math.random() &#x3C; 0.5) { return true; } else { return false; }",
            "output_type": "integer",
            "substitution": true
        }
    ],
    "actions": {
        "type": "personal_sign",
        "check": "",
        "data": "0x000000",
        "substitution": true
    },
    "postHook": []
}
</code></pre></td></tr></tbody></table>

#### createLambda Response

A successful response will return a unique UUID required to execute the lambda function

```json
{
    "jsonrpc": "2.0",
    "result": "a23ef114-c5fb-41c6-b863-0781a3d10ee5",
    "id": 3
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0xpass.io/programmability/lambda-functions/create-lambda/create-lambda-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
