PublicKey
PublicKey
Section titled “PublicKey”Defines a public key for email encryption (OpenPGP or S/MIME).
This object can be configured from the WebUI under Account › Public Keys
Fields
Section titled “Fields”accountId
Section titled “accountId”Type:
Id<Account>· read-onlyIdentifier for the account this public key belongs to
Type:
Text· requiredOpenPGP or S/MIME public key data
description
Section titled “description”Type:
String· requiredDescription of the public key
createdAt
Section titled “createdAt”Type:
UTCDateTime· server-setCreation date of the public key
expiresAt
Section titled “expiresAt”Type:
UTCDateTime?Expiration date of the public key
emailAddresses
Section titled “emailAddresses”Type:
EmailAddress[]Email addresses associated with the public key
JMAP API
Section titled “JMAP API”The PublicKey object is available via the urn:stalwart:jmap capability.
x:PublicKey/get
Section titled “x:PublicKey/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysPublicKeyGet permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/get", { "ids": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:PublicKey/set
Section titled “x:PublicKey/set”This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
Supports create, update, and destroy operations in a single call.
Create
Section titled “Create”This operation requires the sysPublicKeyCreate permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/set", { "create": { "new1": { "description": "Example", "emailAddresses": {}, "key": "Example" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Update
Section titled “Update”This operation requires the sysPublicKeyUpdate permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/set", { "update": { "id1": { "key": "updated value" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Destroy
Section titled “Destroy”This operation requires the sysPublicKeyDestroy permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/set", { "destroy": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:PublicKey/query
Section titled “x:PublicKey/query”This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysPublicKeyQuery permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/query", { "filter": { "accountId": "id1" } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'The x:PublicKey/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):
| Condition | Kind |
|---|---|
accountId | id of Account |
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get PublicKey id1Create
Section titled “Create”stalwart-cli create PublicKey \ --field key=Example \ --field description=Example \ --field 'emailAddresses={}'stalwart-cli query PublicKeystalwart-cli query PublicKey --where accountId=id1Update
Section titled “Update”stalwart-cli update PublicKey id1 --field key='updated value'Delete
Section titled “Delete”stalwart-cli delete PublicKey --ids id1