@mythryl/protocol
v0.1.11
Published
The messages a Mythryl mini app and its host send each other.
Maintainers
Readme
@mythryl/protocol
The messages a Mythryl mini app and its host send each other: types, guards, protocol versions and error codes.
Most apps use @mythryl/app-sdk in the browser and
@mythryl/server-sdk on the server, and never import this package
directly. It is for code that implements the other end of the protocol, such as a host.
npm install @mythryl/protocolContents
- Messages:
RequestMessage,ResponseMessageandEventMessage, with the guardsisRequestMessage,isResponseMessageandisEventMessagefor data received from a transport. - Calls and events: the
Methodsmap (parameters and result of each call),Events, andCapability. - Versions:
SUPPORTED_VERSIONS,LATEST_VERSIONandnegotiate(theirs, ours). A version is never removed after release, so apps built with an older SDK keep working. - Errors:
ProtocolErrorand the codescancelled,unsupported,not_consented,rate_limited,too_large,quota_exceededandunavailable. - Storage:
JsonValue,StorageEntryand the limitsSTORAGE_MAX_KEY_LENGTH,STORAGE_MAX_VALUE_BYTESandSTORAGE_MAX_TOTAL_BYTES, which hosts check against. - Tokens:
APP_TOKEN_TYPE,MYTHRYL_ISSUER,JWKS_PATHand theAppTokenClaimstype for the token returned bysdk.auth.signin().
Message format
Every message carries source: "mythryl" and the protocol version v. A request has an id, a method and params; a
response repeats the id and carries either result or error; an event has an event name and data. The first
request is always hello, which selects the version used afterwards.
License
MIT
