Skip to content

OnlyWorlds Unity SDK 0.62.0

Latest

Choose a tag to compare

@tmoosting tmoosting released this 02 Dec 23:42
· 1 commit to main since this release

A minor release because it adds public API (below). A desktop game can now sign its player in with OnlyWorlds
(the browser opens, the player presses Continue, the game reads their worlds), proven against onlyworlds.com, and
follow a world through the change feed on that token. It also reads a visit's days and end, the front door's
Charter text and a seat's talk, and refuses a name that holds half of a surrogate pair.

Added

  • Sign in with OnlyWorlds for a desktop game, whole: OWClient.SignInForGameAsync. A game's player presses Sign
    in, their browser opens on onlyworlds.com, they press Continue, and the game gets a token that reads their worlds
    (the list of worlds, a world, its elements) and nothing else, for 30 days. The call listens on 127.0.0.1 only, on a
    port the system picks, signs in as OnlyWorlds' one entry for games (OWSignIn.GamesClientId, worlds-only-games,
    returning to http://127.0.0.1:<port>/signin/callback, OWSignIn.GamesReturnPath), and asks world:read always.
    Only the browser's return that carries this sign-in's state ends the wait; every other request to the port is
    answered 404 and the wait goes on, and a repeat of the return gets the same page with no second exchange, since the
    server ends a token whose code is traded twice. OWGameSignInOptions: OnListening (the address, shown before the
    browser opens, to open by hand), OnBrowserFailed, OpenUrl (a launcher that can report a failure;
    Application.OpenURL cannot), Port, Timeout (5 minutes; 1 second to 30 minutes). Cancelling the call's token
    stops it. The player's name is Account.Username in the answer.
  • The sign-in's new reasons: OWSignInReason.TimedOut, Stopped, NoListener (WebGL, Android and iOS answer it
    at once: a web game signs in through the TypeScript SDK in its page), NoBrowser, and NotReadOnly: an answer that
    is not read-only is never handed back; the call asks the server once to end that token (the token as its own
    Bearer, at most 10 seconds) and fails whatever the server answers.
  • Run In Background is on while the games' sign-in waits, and the game's own value comes back at every end: the
    exchange goes through Unity's main thread, which a player that pauses in the background does not run while the
    player is in the browser, and the sign-in's code lives 60 seconds.
  • OWSignInResult.ExpiresAtUnix and IsExpired(now): the token's end as Unix seconds, read from expires_at with any
    offset and fractions of a second; check it before using a token kept between runs. OWSignInResult.ToString()
    names the account's username and the end, never the token or any part of it.
  • OWApiError.NeedsSignIn: 401 key_revoked or invalid_credentials, a signed-in token that is over (ended or
    revoked): offer the sign-in again and keep what was already read. Narrower than IsAuthError, which also takes
    world_gone.
  • A Sign In sample (Package Manager, Samples): a whole sign-in and a sign-out that revokes the token, on one
    screen. It opens no browser until its Open Browser box is ticked; the address is shown to open by hand.
  • The README's new section, "Signing a player in", says when to open the browser (only on the player's own press),
    how to keep the token, and how to sign out.
  • The change feed on an account token. ChangesAsync, its page and its tip read (headOnly), on a client holding
    an account token (ow_a_) with World set reads that world's feed as the token's grant there, sending the Bearer
    and world=<id>: a guest's or a contributor's slice as for their key, a world it cannot read a 404. Without World
    it is an InvalidOperationException, and nothing is sent; a world key sends as before, with no world. OWSync
    follows, as it reads through ChangesAsync. Keep a cursor per world and per signed-in person. Parity with the
    TypeScript SDK 4.229.0, its test vector ported.
  • The front door carries the Charter's own text. OWFrontDoor.CharterText and CharterTextMore, on GET /me
    (OWFrontDoor.Of) and an AI's join answer (OWJoined.FrontDoor): the Charter's description as reading the Law
    serves it to that key, cut to its first 20,000 code points, and true when it was cut (read the rest from the Law).
    "" and false for an empty description; both null where Charter is, and from a server that does not send them.
    Parity with the TypeScript SDK's OwFrontDoor (after 4.228.1), its keys held to the server's document.
  • A visit of seven days. An AI link can be a visit: its seat ends by itself seven days after the AI joins, and its
    key stops working then. OWWorldLinkCreate.Visit (an agent link only; true makes it a visit, refused with role
    co_builder; sent as given, false too, and left out when null). The answers say so: OWWorldLink.Visit (and so
    OWWorldLinkCreated.Visit), OWJoinPreview.VisitDays, OWJoinSeat.EndsAt on an AI's join answer, and
    OWSeat.EndsAt on ListSeatsAsync's rows. GetMeAsync and GetMembersAsync hand on ends_at as served. A seat
    whose visit has ended reads active on the roster until the nightly run removes it: read ends_at. Parity with the
    TypeScript SDK 4.230.0, its test vector ported.
  • A seat's talk. OWSeat.Talk on ListSeatsAsync's rows: on the seat a talk address made, who it talks with,
    until when, and whether the talk has ended (OWSeatTalk: TalkWith, EndsAt, Ended); null on every other seat,
    and from a server that does not send it. A talk address lets a world's owner or a co-builder open one conversation
    between a visitor and one of their own AI seats for seven days; the SDK has no call that makes one. Parity with the
    TypeScript SDK 4.231.0, its test vector ported.

Changed

  • OWSignInResult.ExpiresAt and Scope say that a game's token (worlds-only-games) always ends 720 hours after
    the exchange and is always read-only, as for a client that registered itself (the TypeScript SDK's 4.228.1).
  • A keyless client's refusal names SignInForGameAsync among the calls that work without a key.

Fixed

  • A name that holds half of a surrogate pair is refused. The archive's name check, and so OWWorldArchive.Pack
    and the folder writer's id check (OWFolderWriter.Write, WriteElement), now refuse a name or an id that is not
    well-formed Unicode, in the TypeScript SDK's words (4.227.1): "is not well-formed Unicode: it holds half of a
    surrogate pair". An id built in C# as "abc\ud800" was written to disk as abc and U+FFFD, so a second element
    whose id is abc and U+FFFD wrote over the first one's file; it is now refused with
    character element id "abc\ud800" cannot be a file name: as "abc\ud800.json" it is not well-formed Unicode: it holds half of a surrogate pair., the half written as its escape, and nothing is written. A whole pair (an emoji) is
    one character and passes as before. An id that arrives as JSON holding a lone half is already U+FFFD when
    Newtonsoft hands it over, so on that path the check sees the replaced character and the id is written as abc
    and U+FFFD, where the other packages refuse it.