Lambda PGP Web Service endpoint

Editing code in the Hyperlambda code editor

To edit code, and play around with web service contructs, simply create your code in the above CodeMirror editor. Notice, only 'whitelisted' events will be legally allowed to execute. Se further down on page to see which events are whitelisted. Use Ctrl+Space or Cmd+Space to show code AutoCompletion.

Enabling the web service

In order to allow clients to connect to the web server, you'll need to use 'Peeples' to open it up for the 'guest' account, which you can do with the following access object.

*
  p5.module.allow:/modules/hypereval/lambda-ws/

Enabling clients to download your PGP key

In order to allow clients to download your server's PGP key, you'll need to use 'Peeples' to open up access to it, which you can do with the following access object.

*
  p5.module.allow:/modules/micro/pgp/

Consuming Web Service

To invoke web service, instead of creating a GUI, make sure you submit an HTTP POST request, such as the following example illustrates.

p5.http.post:"https://home.gaiasoul.com/hypereval/lambda-ws"
  Content-Type:application/x-hyperlambda
  content
    +:int:7
      *:int:20
        _:10
    eval-x:x:/+/*
    return
      result:x:/@+?value

To invoke web service using a PGP encrypted and cryptographically signed MIME envelope from Hyperlambda, make sure you submit an HTTP POST request, such as the following example illustrates - At which point the web service will return its results as a PGP encrypted and signed MIME envelope.

p5.http.post:"https://home.gaiasoul.com/hypereval/lambda-ws"
  .onrequest
    .p5.mime.serialize-to-stream
      application:x-hyperlambda

        /*
         * Signing with your server's PGP key.
         */
        sign

        /*
         * Encrypting with this server's public PGP key.
         */
        encrypt
          fingerprint:ea630b9a61448b7f647045c210e1e050ce6feb1d

        /*
         * The actual Hyperlambda content of your request.
         */
        content
          split:Thomas Hansen is pretty cool
            =:" "
          add:x:/+
            src:x:/@split/*?name
          return
  .onresponse
    .p5.mime.load-from-stream

If you choose to create a MIME envelope and cryptographically sign it, with your PGP key, you can also transmit multiple [application:x-hyperlambda] entities, and they will be evaluated in order of appearance (breath first), and have the value of their execution returned in order of appearance. Evaluating a PGP cryptographcally signed web service will also give you access to the entire MIME envelope inside of your own Hyperlambda as a [mime] reference argument, being the entire mime parsing node passed in as a reference node, allowing you to gain access to file attachments and such, which you can also pass in to the web service as you see fit. Any file attachments will have their names 'randomised' and be stored in the "/common/temp/" folder.

You can also of course use CURL or other types of clients, as long as you pass in valid Hyperlambda, and make sure you set the 'Content-Type' HTTP header correctly to 'application/x-hyperlambda', assuming you want to pass in your code as clear text, and not cryptographically signed or encrypted.

If you choose to supply multiple 'application/x-hyperlambda' MIME parts, you'll obviously have to wrap them somehow inside of some sort of 'multipart'.

To retrieve the public PGP key for this server, visit this link

Configuring the web service

The web service can be configured with all sorts of different settings, such as for instance only allowing one or more specified PGP keys to be able to invoke it, changing the whitelisted event list, etc, etc, etc. See its code using for instance 'Hypereval' for details about this.

Legal Active Events

  • set
  • add
  • insert-before
  • insert-after
  • src
  • +
  • -
  • /
  • *
  • for-each
  • continue
  • break
  • return
  • eval-x
  • switch
  • case
  • default
  • try
  • catch
  • finally
  • if
  • else-if
  • else
  • fetch
  • starts-with
  • ends-with
  • index-of
  • join
  • length
  • replace
  • split
  • throw
  • to-lower
  • to-upper
  • trim
  • trim-left
  • trim-right
  • =
  • !=
  • >
  • <
  • >=
  • <=
  • ~
  • !~
  • hyper2lambda
  • lambda2hyper

See the Hyperlambda code in Hypereval for more information about how to consume and configure the web service.