urbit/pkg/npm/http-api
matildepark 400a437b08 http-api: authenticate doesn't enforce insecure connections
Instead of forcing people to connect over http://, fall back gracefully to http if no protocol is given.

This fixes an issue where external clients can't use this method, since SameSite cookies need to be secure as per https://web.dev/samesite-cookies-explained/#samesite=none-must-be-secure
2022-09-13 11:27:38 -05:00
..
example http-api: update to working example 2021-11-09 12:26:40 -06:00
src http-api: authenticate doesn't enforce insecure connections 2022-09-13 11:27:38 -05:00
test @urbit/http-api: update tests 2022-05-26 09:26:10 -05:00
.babelrc api,http-api: updating babel usage and fixing tests 2021-11-09 13:16:48 -06:00
.gitignore npm: removing intermediate ts files from pkg, fixing more bad references 2021-11-10 17:54:31 -06:00
jest.config.cjs api,http-api: updating babel usage and fixing tests 2021-11-09 13:16:48 -06:00
package-lock.json Merge branch 'next/groups' into hm/landscape-perf-optimization 2022-03-11 15:45:00 -06:00
package.json npm: bump http-api version number 2022-09-13 10:33:12 -05:00
README.md added NPM packages 2021-01-26 21:45:18 -08:00
rollup.config.ts http-api: updating dist to be more compatible with node 2022-04-20 10:00:46 -05:00
setupEnv.js @urbit/http-api: setup testing 2021-07-12 12:07:19 +10:00
tsconfig.json npm: removing intermediate ts files from pkg, fixing more bad references 2021-11-10 17:54:31 -06:00

Urbit Connector

This project allows you to connect to an Urbit ship via a JavaScript application.

Example

Check out the example directory for examples of how to use this code.

  1. Open example/index.html in your browser and follow the instructions there, or
  2. With a ship running in the same fashion as indicated in the file above, run node example/index.js

The code for either of these can be found in src/example/browser.js or src/example/node.js, depending on your context.

Design

This library is designed to be useful for node applications that communicate with an urbit running either on the local computer or on a remote one.

The majority of its methods are asynchronous and return Promises. This is due to the non-blocking nature of JavaScript. If used in a React app, response handlers should be bound with this to setState after a message is received.

NOTE

You must enable CORS requests on your urbit for this library to work in browser context. Use +cors-registry to see domains which have made requests to your urbit, and then approve the needed one, e.g. |cors-approve http://zod.arvo.network.