Passport
  • 👩‍💻Welcome
  • How Passport Works
    • Overview
    • Background
      • Threshold Cryptography
      • Secure Multi-Party Computation
      • Distributed Architecture
      • Secure Enclaves
    • In Depth
      • Under the Hood
      • User Flows and Account Controls
      • The Halides Model
      • End-to-End Encryption
      • Security
      • Node Operation
  • guides and examples
    • Getting Started
    • Quickstarts and Examples
      • Passkey Account
      • Clerk Auth
      • Lambda Quickstart
  • Authentication
    • Overview
    • Configuring your scope
    • Passkeys
      • Registration
        • Register using SDK
        • Register using API
          • Initiate Registration
          • Complete Registration
      • Authentication
        • Authenticating with SDK
        • Authenticating with API
          • Initiate Authentication
          • Complete Authentication
    • Developer Owned Auth
      • Registration
        • Register using SDK
        • Register using API
          • Delegate Registration
  • Wallet Operations
    • Overview
    • Passkeys Signer
      • Sign Message
        • Sign Message SDK
        • Sign Message API
      • Sign Transaction
        • Sign Transaction SDK
        • Sign Transaction API
    • DOA Signer
      • Sign Message
        • Sign Message SDK
        • Sign Message API
      • Sign Transaction
        • Sign Transaction SDK
        • Sign Transaction API
    • Viem Support
  • Programmability
    • Overview
    • Passport Lambda
    • Lambda Functions
      • Create Lambda
        • Create Lambda SDK
        • Create Lambda API
      • Execute Lambda
        • Execute Lambda SDK
        • Execute Lambda API
      • List Lambda
        • List Lambda SDK
        • List Lambda API
  • Appendix
    • Moving to Mainnet
    • State Of The Network
    • Generating DOA Keys
    • API Request Setup
      • Unauthenticated Requests
      • Authenticated Requests
Powered by GitBook
On this page
  1. Programmability
  2. Lambda Functions
  3. Create Lambda

Create Lambda SDK

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

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

Parameter
Description
Example Values

data

createLambda Response

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

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

PreviousCreate LambdaNextCreate Lambda API

Last updated 11 months ago

Refer to for more info.

{
    "authorization": {
        "type": "none"
    },
    "verifications": {
        "count": 1
    },
    "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": []
}
Full Spec