Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodoc #872

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .autodoc/docs/data/args.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"space":"cosine","numDimensions":1536}
1 change: 1 addition & 0 deletions .autodoc/docs/data/docstore.json

Large diffs are not rendered by default.

Binary file added .autodoc/docs/data/hnswlib.index
Binary file not shown.
7 changes: 7 additions & 0 deletions .autodoc/docs/json/ci/import_gpg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "import_gpg.sh",
"filePath": "ci/import_gpg.sh",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/ci/import_gpg.sh",
"summary": "This code is a Bash script that sets up GPG2 for reading a passphrase from parameters. It is used in the larger project to enable secure communication between different components of the system. \n\nThe script first creates a directory called `.gnupg` in the user's home directory and sets its permissions to 700. It then adds two lines to the `gpg.conf` file: `use-agent` and `pinentry-mode loopback`. These lines configure GPG to use an agent for passphrase management and to use a loopback mechanism for pinentry, which allows the passphrase to be entered via parameters. The script also adds a line to the `gpg-agent.conf` file to allow loopback pinentry. Finally, it sets the permissions of all files in the `.gnupg` directory to 600 and reloads the GPG agent.\n\nThe script then decodes the GPG signing key, which should have been previously exported and stored as a GitHub repository secret under the name `GPG_SIGNING_KEY`. The decoded key is saved to a file called `private.key` in the `.gnupg` directory. Finally, the script imports the key using the `gpg` command with the `--import` option.\n\nThis script is used in the larger project to enable secure communication between different components of the system. By setting up GPG2 with passphrase management via parameters, the system can ensure that only authorized users are able to access sensitive information. For example, if the system needs to send encrypted messages between two components, it can use GPG to encrypt the message with the recipient's public key and sign it with the sender's private key. The recipient can then use their private key to decrypt the message and verify the signature. This ensures that the message has not been tampered with and that it was sent by the expected sender. \n\nExample usage of this script in the larger project:\n\n```\n#!/bin/bash\n\n# set up GPG for secure communication\n./setup_gpg.sh\n\n# encrypt and sign a message\necho \"Hello, world!\" | gpg --encrypt --sign --recipient [email protected] --armor > message.asc\n\n# send the encrypted message to the recipient\nsend_message message.asc\n```",
"questions": "1. What is the purpose of this script?\n \n This script sets up gpg2 for reading passphrase from parameters and imports a private key for signing.\n\n2. What is the significance of the environment variable \"GPG_SIGNING_KEY\"?\n \n The environment variable \"GPG_SIGNING_KEY\" contains the base64 encoded private key that is decoded and stored in the ~/.gnupg/private.key file.\n\n3. Why is the \"use-agent\" option added to the gpg.conf file?\n \n The \"use-agent\" option is added to the gpg.conf file to enable the use of the gpg-agent for caching passphrases and avoiding repeated prompts for the passphrase."
}
17 changes: 17 additions & 0 deletions .autodoc/docs/json/ci/summary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"folderName": "ci",
"folderPath": ".autodoc/docs/json/ci",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/.autodoc/docs/json/ci",
"files": [
{
"fileName": "import_gpg.sh",
"filePath": "ci/import_gpg.sh",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/ci/import_gpg.sh",
"summary": "This code is a Bash script that sets up GPG2 for reading a passphrase from parameters. It is used in the larger project to enable secure communication between different components of the system. \n\nThe script first creates a directory called `.gnupg` in the user's home directory and sets its permissions to 700. It then adds two lines to the `gpg.conf` file: `use-agent` and `pinentry-mode loopback`. These lines configure GPG to use an agent for passphrase management and to use a loopback mechanism for pinentry, which allows the passphrase to be entered via parameters. The script also adds a line to the `gpg-agent.conf` file to allow loopback pinentry. Finally, it sets the permissions of all files in the `.gnupg` directory to 600 and reloads the GPG agent.\n\nThe script then decodes the GPG signing key, which should have been previously exported and stored as a GitHub repository secret under the name `GPG_SIGNING_KEY`. The decoded key is saved to a file called `private.key` in the `.gnupg` directory. Finally, the script imports the key using the `gpg` command with the `--import` option.\n\nThis script is used in the larger project to enable secure communication between different components of the system. By setting up GPG2 with passphrase management via parameters, the system can ensure that only authorized users are able to access sensitive information. For example, if the system needs to send encrypted messages between two components, it can use GPG to encrypt the message with the recipient's public key and sign it with the sender's private key. The recipient can then use their private key to decrypt the message and verify the signature. This ensures that the message has not been tampered with and that it was sent by the expected sender. \n\nExample usage of this script in the larger project:\n\n```\n#!/bin/bash\n\n# set up GPG for secure communication\n./setup_gpg.sh\n\n# encrypt and sign a message\necho \"Hello, world!\" | gpg --encrypt --sign --recipient [email protected] --armor > message.asc\n\n# send the encrypted message to the recipient\nsend_message message.asc\n```",
"questions": "1. What is the purpose of this script?\n \n This script sets up gpg2 for reading passphrase from parameters and imports a private key for signing.\n\n2. What is the significance of the environment variable \"GPG_SIGNING_KEY\"?\n \n The environment variable \"GPG_SIGNING_KEY\" contains the base64 encoded private key that is decoded and stored in the ~/.gnupg/private.key file.\n\n3. Why is the \"use-agent\" option added to the gpg.conf file?\n \n The \"use-agent\" option is added to the gpg.conf file to enable the use of the gpg-agent for caching passphrases and avoiding repeated prompts for the passphrase."
}
],
"folders": [],
"summary": "The `import_gpg.sh` script in the `.autodoc/docs/json/ci` folder is a crucial component for enabling secure communication between different parts of the system. It sets up GPG2 (GNU Privacy Guard) with passphrase management via parameters, ensuring that only authorized users can access sensitive information.\n\nThe script performs the following tasks:\n\n1. Creates a `.gnupg` directory in the user's home directory with permissions set to 700.\n2. Configures GPG to use an agent for passphrase management and loopback mechanism for pinentry by adding `use-agent` and `pinentry-mode loopback` lines to the `gpg.conf` file.\n3. Allows loopback pinentry by adding a line to the `gpg-agent.conf` file.\n4. Sets permissions of all files in the `.gnupg` directory to 600 and reloads the GPG agent.\n5. Decodes the GPG signing key, which should be stored as a GitHub repository secret under the name `GPG_SIGNING_KEY`, and saves it to a `private.key` file in the `.gnupg` directory.\n6. Imports the key using the `gpg` command with the `--import` option.\n\nThis script is essential for secure communication in the larger project. For instance, when the system needs to send encrypted messages between two components, it can use GPG to encrypt the message with the recipient's public key and sign it with the sender's private key. The recipient can then use their private key to decrypt the message and verify the signature, ensuring the message's integrity and authenticity.\n\nHere's an example of how this script might be used in the larger project:\n\n```bash\n#!/bin/bash\n\n# set up GPG for secure communication\n./import_gpg.sh\n\n# encrypt and sign a message\necho \"Hello, world!\" | gpg --encrypt --sign --recipient [email protected] --armor > message.asc\n\n# send the encrypted message to the recipient\nsend_message message.asc\n```\n\nIn this example, the `import_gpg.sh` script is first executed to set up GPG for secure communication. Then, a message is encrypted and signed using the `gpg` command with the recipient's email address. The encrypted message is saved to a file called `message.asc`. Finally, a hypothetical `send_message` function is called to send the encrypted message to the recipient.",
"questions": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"folderName": "kiama",
"folderPath": ".autodoc/docs/json/common/shared/src/main/scala-2.11/sigmastate/kiama",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/.autodoc/docs/json/common/shared/src/main/scala-2.11/sigmastate/kiama",
"files": [],
"folders": [
{
"folderName": "util",
"folderPath": ".autodoc/docs/json/common/shared/src/main/scala-2.11/sigmastate/kiama/util",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/.autodoc/docs/json/common/shared/src/main/scala-2.11/sigmastate/kiama/util",
"files": [
{
"fileName": "Collections.scala",
"filePath": "common/shared/src/main/scala-2.11/sigmastate/kiama/util/Collections.scala",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/common/shared/src/main/scala-2.11/sigmastate/kiama/util/Collections.scala",
"summary": "The code in this file provides utility functions for working with collections in Scala. It defines a Scala object called Collections that contains several methods for converting between Java and Scala collections, as well as for building collections.\n\nThe first set of methods are for converting Java collections to Scala collections. These methods use the JavaConverters library to convert a Java collection to a Scala collection. Specifically, the javaCollectionToVector method takes a java.util.Collection and returns a Vector, which is a type of immutable sequence in Scala. This method can be useful when working with Java libraries that return collections that need to be used in Scala code.\n\nThe second method, mapToJavaMap, takes a Scala Map and returns a java.util.Map. This method can be useful when working with Java libraries that require a Java Map as input.\n\nThe third method, seqToJavaList, takes a Scala Seq and returns a java.util.List. This method can be useful when working with Java libraries that require a Java List as input.\n\nThe second set of methods are for building collections. The newBuilder method takes a Factory or CanBuildFrom object and returns a Builder object. The Factory and CanBuildFrom types are part of the Scala collections library and are used to create new collections. The newBuilder method can be used to create a new Builder object that can be used to add elements to a collection. The first version of the method takes a Factory object, which is used to create a new collection of type C. The second version of the method takes a CanBuildFrom object and an initial collection of type A, and is used to create a new collection of type C.\n\nOverall, this code provides useful utility functions for working with collections in Scala, particularly when interfacing with Java libraries.",
"questions": "1. What is the purpose of this file?\n- This file contains utility functions for converting between Java and Scala collections, as well as building collections.\n\n2. What external libraries or dependencies does this file use?\n- This file uses the JavaConverters and CanBuildFrom classes from the Scala standard library.\n\n3. What is the license for this code?\n- This code is licensed under the Mozilla Public License, version 2.0."
}
],
"folders": [],
"summary": "The `Collections.scala` file in the `.autodoc/docs/json/common/shared/src/main/scala-2.11/sigmastate/kiama/util` folder provides utility functions for working with collections in Scala, particularly when interfacing with Java libraries. It defines a Scala object called `Collections` that contains several methods for converting between Java and Scala collections, as well as for building collections.\n\n### Converting Java collections to Scala collections\n\nThe first set of methods are for converting Java collections to Scala collections. These methods use the `JavaConverters` library to convert a Java collection to a Scala collection. For example, the `javaCollectionToVector` method takes a `java.util.Collection` and returns a `Vector`, which is a type of immutable sequence in Scala:\n\n```scala\nimport java.util.ArrayList\nimport sigmastate.kiama.util.Collections._\n\nval javaList = new ArrayList[String]()\njavaList.add(\"hello\")\njavaList.add(\"world\")\n\nval scalaVector = javaCollectionToVector(javaList)\n```\n\n### Converting Scala collections to Java collections\n\nThe second and third methods, `mapToJavaMap` and `seqToJavaList`, take a Scala `Map` and `Seq` respectively and return their Java counterparts, `java.util.Map` and `java.util.List`. These methods can be useful when working with Java libraries that require Java collections as input:\n\n```scala\nimport scala.collection.immutable.HashMap\nimport java.util.List\nimport sigmastate.kiama.util.Collections._\n\nval scalaMap = HashMap(\"one\" -> 1, \"two\" -> 2)\nval javaMap = mapToJavaMap(scalaMap)\n\nval scalaSeq = Seq(\"hello\", \"world\")\nval javaList: List[String] = seqToJavaList(scalaSeq)\n```\n\n### Building collections\n\nThe `newBuilder` method takes a `Factory` or `CanBuildFrom` object and returns a `Builder` object. The `Factory` and `CanBuildFrom` types are part of the Scala collections library and are used to create new collections. The `newBuilder` method can be used to create a new `Builder` object that can be used to add elements to a collection:\n\n```scala\nimport scala.collection.mutable.Builder\nimport scala.collection.immutable.Vector\nimport sigmastate.kiama.util.Collections._\n\nval builder: Builder[String, Vector[String]] = newBuilder(Vector)\nbuilder += \"hello\"\nbuilder += \"world\"\n\nval scalaVector = builder.result()\n```\n\nIn summary, the `Collections.scala` file provides useful utility functions for working with collections in Scala, particularly when interfacing with Java libraries. These functions can be used to convert between Java and Scala collections and to build new collections using the `Builder` object.",
"questions": ""
}
],
"summary": "The `Collections.scala` file in the `.autodoc/docs/json/common/shared/src/main/scala-2.11/sigmastate/kiama/util` folder provides utility functions for working with collections in Scala, particularly when interfacing with Java libraries. It defines a Scala object called `Collections` that contains several methods for converting between Java and Scala collections, as well as for building collections.\n\n### Converting Java collections to Scala collections\n\nThe first set of methods are for converting Java collections to Scala collections. These methods use the `JavaConverters` library to convert a Java collection to a Scala collection. For example, the `javaCollectionToVector` method takes a `java.util.Collection` and returns a `Vector`, which is a type of immutable sequence in Scala:\n\n```scala\nimport java.util.ArrayList\nimport sigmastate.kiama.util.Collections._\n\nval javaList = new ArrayList[String]()\njavaList.add(\"hello\")\njavaList.add(\"world\")\n\nval scalaVector = javaCollectionToVector(javaList)\n```\n\n### Converting Scala collections to Java collections\n\nThe second and third methods, `mapToJavaMap` and `seqToJavaList`, take a Scala `Map` and `Seq` respectively and return their Java counterparts, `java.util.Map` and `java.util.List`. These methods can be useful when working with Java libraries that require Java collections as input:\n\n```scala\nimport scala.collection.immutable.HashMap\nimport java.util.List\nimport sigmastate.kiama.util.Collections._\n\nval scalaMap = HashMap(\"one\" -> 1, \"two\" -> 2)\nval javaMap = mapToJavaMap(scalaMap)\n\nval scalaSeq = Seq(\"hello\", \"world\")\nval javaList: List[String] = seqToJavaList(scalaSeq)\n```\n\n### Building collections\n\nThe `newBuilder` method takes a `Factory` or `CanBuildFrom` object and returns a `Builder` object. The `Factory` and `CanBuildFrom` types are part of the Scala collections library and are used to create new collections. The `newBuilder` method can be used to create a new `Builder` object that can be used to add elements to a collection:\n\n```scala\nimport scala.collection.mutable.Builder\nimport scala.collection.immutable.Vector\nimport sigmastate.kiama.util.Collections._\n\nval builder: Builder[String, Vector[String]] = newBuilder(Vector)\nbuilder += \"hello\"\nbuilder += \"world\"\n\nval scalaVector = builder.result()\n```\n\nIn summary, the `Collections.scala` file provides useful utility functions for working with collections in Scala, particularly when interfacing with Java libraries. These functions can be used to convert between Java and Scala collections and to build new collections using the `Builder` object.",
"questions": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "Collections.scala",
"filePath": "common/shared/src/main/scala-2.11/sigmastate/kiama/util/Collections.scala",
"url": "sigmastate-interpreterhttps://github.com/ScorexFoundation/sigmastate-interpreter/common/shared/src/main/scala-2.11/sigmastate/kiama/util/Collections.scala",
"summary": "The code in this file provides utility functions for working with collections in Scala. It defines a Scala object called Collections that contains several methods for converting between Java and Scala collections, as well as for building collections.\n\nThe first set of methods are for converting Java collections to Scala collections. These methods use the JavaConverters library to convert a Java collection to a Scala collection. Specifically, the javaCollectionToVector method takes a java.util.Collection and returns a Vector, which is a type of immutable sequence in Scala. This method can be useful when working with Java libraries that return collections that need to be used in Scala code.\n\nThe second method, mapToJavaMap, takes a Scala Map and returns a java.util.Map. This method can be useful when working with Java libraries that require a Java Map as input.\n\nThe third method, seqToJavaList, takes a Scala Seq and returns a java.util.List. This method can be useful when working with Java libraries that require a Java List as input.\n\nThe second set of methods are for building collections. The newBuilder method takes a Factory or CanBuildFrom object and returns a Builder object. The Factory and CanBuildFrom types are part of the Scala collections library and are used to create new collections. The newBuilder method can be used to create a new Builder object that can be used to add elements to a collection. The first version of the method takes a Factory object, which is used to create a new collection of type C. The second version of the method takes a CanBuildFrom object and an initial collection of type A, and is used to create a new collection of type C.\n\nOverall, this code provides useful utility functions for working with collections in Scala, particularly when interfacing with Java libraries.",
"questions": "1. What is the purpose of this file?\n- This file contains utility functions for converting between Java and Scala collections, as well as building collections.\n\n2. What external libraries or dependencies does this file use?\n- This file uses the JavaConverters and CanBuildFrom classes from the Scala standard library.\n\n3. What is the license for this code?\n- This code is licensed under the Mozilla Public License, version 2.0."
}
Loading