﻿<?xml version='1.0' encoding='utf-8'?>
<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:nfi:iot:leg:id:1.0'
    xmlns='urn:nfi:iot:leg:id:1.0'
    xmlns:e2='urn:nfi:iot:e2e:1.0'
    elementFormDefault='qualified'>

	<xs:import namespace='urn:nfi:iot:e2e:1.0'/>

	<xs:element name='getPublicKey'>
		<xs:annotation>
			<xs:documentation>Sent by one entity to another when it needs to get the public key of the other.</xs:documentation>
			<xs:documentation>Expected response element: publicKey</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='ts' type='xs:dateTime' use='optional'>
				<xs:annotation>
					<xs:documentation>Timestamp indicating a time when the public key was used, in UTC.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='publicKey'>
		<xs:annotation>
			<xs:documentation>Contains a public key.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:group ref='e2:PublicKeys' minOccurs='1' maxOccurs='1'>
				<xs:annotation>
					<xs:documentation>Public keys corresponding to available methods to create signatures.</xs:documentation>
				</xs:annotation>
			</xs:group>
			<xs:attribute name='from' type='xs:dateTime' use='required'>
				<xs:annotation>
					<xs:documentation>Timestamp indicating when the public key was created, in UTC.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='to' type='xs:dateTime' use='optional'>
				<xs:annotation>
					<xs:documentation>Timestamp indicating when the public key was replaced or changed, and no longer used for creating signatures, in UTC.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='applicationAttributes'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq get to a Trust Provider, to get a list of attributes and properties relevant for applications for legal identities on the broker.</xs:documentation>
			<xs:documentation>Expected response element: idApplicationAttributes</xs:documentation>
		</xs:annotation>
		<xs:complexType/>
	</xs:element>

	<xs:element name='idApplicationAttributes'>
		<xs:annotation>
			<xs:documentation>Element sent as a response to an applicationAttributes request.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='required' type='xs:string' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Contains the name of a property that is required for an identity application to be allowed to participate in peer review.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name='authenticator' type='IdentityReviewService' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Contains requirements of an identity authenticator service.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name='peerReviewService' type='IdentityReviewService' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Contains requirements of an identity peer review service.</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
			<xs:attribute name='peerReview' type='xs:boolean' use='optional' default='false'>
				<xs:annotation>
					<xs:documentation>Indicates if the Trust Provider accepts peer reviews of identity applications.</xs:documentation>
					<xs:documentation>If enabled, additional attributes and child elements detail what is expected by identity applications to be permitted to participate in peer reviews.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='nrReviewers' type='xs:positiveInteger' use='optional'>
				<xs:annotation>
					<xs:documentation>If peerReview is enabled, this attribute indicates the number of reviewers with positive reviews that are required for an identity application to be approved.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='nrPhotos' type='xs:nonNegativeInteger' use='optional' default='0'>
				<xs:annotation>
					<xs:documentation>If peerReview is enabled, number of photos required for an identity application to be allowed to participate in a peer review process.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='iso3166' type='xs:boolean' use='optional' default='false'>
				<xs:annotation>
					<xs:documentation>Indicates if the Trust Provider requires ISO 3166 country codes for identity applications.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='reviewTimeout' type='xs:positiveInteger' use='optional' default='3600'>
				<xs:annotation>
					<xs:documentation>The time the client has (in seconds) to sign an identity review document and upload it as a signed attachment, measured from the time the application was approved.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:complexType name='RequiredAndOptionalLists'>
		<xs:annotation>
			<xs:documentation>Type listing required and optional elements in a sequence.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name='required' type='xs:string' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Defines one required item.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name='optional' type='xs:string' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Defines one optional item.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name='IdentityReviewService'>
		<xs:annotation>
			<xs:documentation>Represents a service used for reviewing identity applications.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name='properties' type='RequiredAndOptionalLists' minOccurs='0' maxOccurs='1'>
				<xs:annotation>
					<xs:documentation>Contains a list of required or optional properties expected by the service.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name='attachments' type='RequiredAndOptionalLists' minOccurs='0' maxOccurs='1'>
				<xs:annotation>
					<xs:documentation>Contains a list of required or optional attachments expected by the service.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name='id' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Identifier of the service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='name' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Name of the service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='fqn' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Fully qualified name of the service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='iconUrl' type='xs:anyURI' use='optional'>
			<xs:annotation>
				<xs:documentation>Optional icon associated with service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='iconWidth' type='xs:positiveInteger' use='optional'>
			<xs:annotation>
				<xs:documentation>Witdh of optional icon associated with service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='iconHeight' type='xs:positiveInteger' use='optional'>
			<xs:annotation>
				<xs:documentation>Height of optional icon associated with service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:element name='apply'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider, to apply for a pairing between the online identity (bare JID) of the sender and a Legal Identity.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
			<xs:documentation>Note: The approval process is taken care of out-of-band.</xs:documentation>
			<xs:documentation>Note: Whenever the state of the legal identity is changed on the server, a message is sent to the bare JID of the account, containing the identity, in an identity element. Identities should only be accepted by clients, if the provider corresponds to the sender, and if the server signature is valid, and corresponds to the public key of the server.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref='identity'>
					<xs:annotation>
						<xs:documentation>The legal identity the client wishes to assign to the account.</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
			<xs:attribute name='preview' type='xs:boolean' use='optional' default='false'>
				<xs:annotation>
					<xs:documentation>If set to true, the application is a preview of a coming application, and is not persisted as a normal application, but kept in short-lived protected memory only, and are removed once validation of the following identity application concludes.</xs:documentation>
					<xs:documentation>Allows a client to test the creation and verification of a digital identity, without creating a persisted identity.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='days' type='xs:positiveInteger' use='optional'>
				<xs:annotation>
					<xs:documentation>Requested number of days the resulting identity object should be valid. The Broker may reduce this number or set its own limit.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='identity'>
		<xs:annotation>
			<xs:documentation>Element containing information about a legal identity.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='clientPublicKey' minOccurs='1' maxOccurs='1'>
					<xs:complexType>
						<xs:group ref='e2:PublicKeys' minOccurs='1' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>Public keys corresponding to available methods to create signatures.</xs:documentation>
							</xs:annotation>
						</xs:group>
					</xs:complexType>
				</xs:element>
				<xs:element name='property' minOccurs='1' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>An identity consists of a sequence of properties.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:attribute name='name' type='xs:string' use='required'>
							<xs:annotation>
								<xs:documentation>Name of the property.</xs:documentation>
								<xs:documentation>Predefined names:</xs:documentation>
								<xs:documentation>FIRST = First name</xs:documentation>
								<xs:documentation>MIDDLE = Middle name</xs:documentation>
								<xs:documentation>LAST = Last name</xs:documentation>
								<xs:documentation>FULLNAME = Full name. Can be used instead of FIRST, MIDDLE and LAST.</xs:documentation>
								<xs:documentation>PNR = Personal number</xs:documentation>
								<xs:documentation>ADDR = Address</xs:documentation>
								<xs:documentation>ADDR2 = Address, second line</xs:documentation>
								<xs:documentation>ZIP = Zip or postal code</xs:documentation>
								<xs:documentation>AREA = Area</xs:documentation>
								<xs:documentation>CITY = City</xs:documentation>
								<xs:documentation>REGION = Region, state</xs:documentation>
								<xs:documentation>COUNTRY = Country</xs:documentation>
								<xs:documentation>NATIONALITY = Nationality</xs:documentation>
								<xs:documentation>BDAY = Birth Day</xs:documentation>
								<xs:documentation>BMONTH = Birth Month</xs:documentation>
								<xs:documentation>BYEAR = Birth Year</xs:documentation>
								<xs:documentation>AGEABOVE = Age above the stated number of years</xs:documentation>
								<xs:documentation>GENDER = Gender (M or F)</xs:documentation>
								<xs:documentation>PHONE = Phone number, international phone number format.</xs:documentation>
								<xs:documentation>EMAIL = E-mail address.</xs:documentation>
								<xs:documentation>JID = XMPP address (Jabber ID).</xs:documentation>
								<xs:documentation>DOMAIN = If the ID represents the legal representative of a domain.</xs:documentation>
								<xs:documentation>HOMEPAGE = If the ID represents the legal representative of a domain.</xs:documentation>
								<xs:documentation>PREVIEW = A reference to a preview of the identity application.</xs:documentation>
								<xs:documentation>PSEUDONYM = Lists which properties are pseudonymous. Comma-separated list.</xs:documentation>
								<xs:documentation>PROFILE = Name of Identity Profile or Identity Profiles (Comma-separated list).</xs:documentation>
								<xs:documentation>DEVICE_ID = Device-specific identifier of the device.</xs:documentation>
								<xs:documentation>ORGNAME = Name of organization</xs:documentation>
								<xs:documentation>ORGNR = Organization number</xs:documentation>
								<xs:documentation>ORGDEPT = Organization department, where person works.</xs:documentation>
								<xs:documentation>ORGROLE = Role of person in organization.</xs:documentation>
								<xs:documentation>ORGADDR = Address of organization.</xs:documentation>
								<xs:documentation>ORGADDR2 = Address of organization, second line</xs:documentation>
								<xs:documentation>ORGZIP = Zip or postal code of organization</xs:documentation>
								<xs:documentation>ORGAREA = Area of organization.</xs:documentation>
								<xs:documentation>ORGCITY = City of organization.</xs:documentation>
								<xs:documentation>ORGREGION = Region or state of organization.</xs:documentation>
								<xs:documentation>ORGCOUNTRY = Country code of organization.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='value' type='xs:string' use='required'>
							<xs:annotation>
								<xs:documentation>Value of the property.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
					</xs:complexType>
				</xs:element>
				<xs:element name='clientSignature' minOccurs='1' maxOccurs='1'>
					<xs:annotation>
						<xs:documentation>Client signature of the identity.</xs:documentation>
						<xs:documentation>The signature is calculated on the identity element excluding the id attribute and the clientSignature, status and serverSignature elements.</xs:documentation>
						<xs:documentation>All text nodes and attribute values contain XML-encoded normalized Unicode text (in NFC).</xs:documentation>
						<xs:documentation>XML is normalized. Unnecessary white space removed. Space characters only allowed whitespace.</xs:documentation>
						<xs:documentation>The normalized XML, with attributes in alphabetical order, using double quotes, xmlns attributes only when required, &amp;, &lt;, &gt;, &quot; and &apos; consistently escaped, empty elements are closed using /&gt;, and no space when ending empty element, is UTF-8 encoded before being signed.</xs:documentation>
						<xs:documentation>The identity element never includes the xmlns attribute when calculating the signature.</xs:documentation>
						<xs:documentation>Note: The purpose of the signature, is for the server to validate that the client has access to the private keys corresponding to the public keys registered with the trust provider, and that the contents of the identity is consistent over time.</xs:documentation>
						<xs:documentation>Note: Legal identities are updated by the client regularly. Check with the server to get the most recent legal identity, if needed.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base='xs:base64Binary'>
								<xs:annotation>
									<xs:documentation>Digital signature created using the corresponding client public-key algorithm.</xs:documentation>
								</xs:annotation>
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
				<xs:element ref='attachment' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Any attached items associated with the identity.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name='status' minOccurs='0' maxOccurs='1'>
					<xs:annotation>
						<xs:documentation>The status object is created and managed by the Trust Provider.</xs:documentation>
						<xs:documentation>Authorized entities can get the latest version of the legal identity by requesting it from the trust provider, given the id of the legal identity.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:attribute name='provider' type='xs:string' use='required'>
							<xs:annotation>
								<xs:documentation>JID of Trust Provider validating the correctness of the identity.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='state' type='IdentityState' use='required'>
							<xs:annotation>
								<xs:documentation>Contains information about the current statue of the legal identity registration.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='created' type='xs:dateTime' use='required'>
							<xs:annotation>
								<xs:documentation>When the legal identity was first created.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='updated' type='xs:dateTime' use='optional'>
							<xs:annotation>
								<xs:documentation>When the legal identity was last updated.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='from' type='xs:date' use='optional'>
							<xs:annotation>
								<xs:documentation>From what date (inclusive) the legal identity can be used.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='to' type='xs:date' use='optional'>
							<xs:annotation>
								<xs:documentation>To what date (inclusive) the legal identity can be used.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
					</xs:complexType>
				</xs:element>
				<xs:element name='serverSignature' minOccurs='0' maxOccurs='1'>
					<xs:annotation>
						<xs:documentation>Server signature of the identity.</xs:documentation>
						<xs:documentation>The signature is calculated on the identity element excluding the serverSignature element.</xs:documentation>
						<xs:documentation>All text nodes and attribute values contain XML-encoded normalized Unicode text (in NFC).</xs:documentation>
						<xs:documentation>XML is normalized. Unnecessary white space removed. Space characters only allowed whitespace.</xs:documentation>
						<xs:documentation>The normalized XML, with attributes in alphabetical order, using double quotes, xmlns attributes only when required, &amp;, &lt;, &gt;, &quot; and &apos; consistently escaped, empty elements are closed using /&gt;, and no space when ending empty element, is UTF-8 encoded before being signed.</xs:documentation>
						<xs:documentation>The identity element never includes the xmlns attribute when calculating the signature.</xs:documentation>
						<xs:documentation>Note: The purpose of the server signature, is to validate the legal identity to other clients that have access to the server public keys.</xs:documentation>
						<xs:documentation>Note: Server keys may change over time. If a signature does not validate, make sure to get the most recent public key from the server and check signature again.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base='xs:base64Binary'>
								<xs:annotation>
									<xs:documentation>Digital signature created using the corresponding server public-key algorithm.</xs:documentation>
								</xs:annotation>
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
				<xs:element ref='attachmentRef' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Any downloadable references to attachments assigned to the legal identity.</xs:documentation>
						<xs:documentation>As references might change over time, they are not included in signatures.</xs:documentation>
						<xs:documentation>All meta-data necessary to assert the validity and integrity of attachments are provided using attachment elements above.</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
			<xs:attribute name='id' type='xs:string' use='optional'>
				<xs:annotation>
					<xs:documentation>An identifier assigned to the legal identity.</xs:documentation>
					<xs:documentation>The identifier is formed as a JID, but is not a JID. The domain part corresponds to the domain of the Trust Provider.</xs:documentation>
					<xs:documentation>A client must not include an identifier when it applies for a legal identity pairing with the Trust Provider.</xs:documentation>
					<xs:documentation>Note: Legal IDs are case insensitive in searches and references.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='visibility' type='IdentityVisibility' use='optional' default='Private'>
				<xs:annotation>
					<xs:documentation>Visibility of Identity.</xs:documentation>
					<xs:documentation>Attribute must only be serialized if not Private.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:simpleType name='IdentityVisibility'>
		<xs:annotation>
			<xs:documentation>Visibility types for Legal Identities.</xs:documentation>
		</xs:annotation>
		<xs:restriction base='xs:string'>
			<xs:enumeration value='Private'>
				<xs:annotation>
					<xs:documentation>Identity is private, and must be petitioned for access.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Domain'>
				<xs:annotation>
					<xs:documentation>Identity is accessible to anyone with an account on the same domain. The rest must petition for access.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Public'>
				<xs:annotation>
					<xs:documentation>Identity is accessible to anyone.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='IdentityState'>
		<xs:annotation>
			<xs:documentation>Lists recognized legal identity states.</xs:documentation>
		</xs:annotation>
		<xs:restriction base='xs:string'>
			<xs:enumeration value='Created'>
				<xs:annotation>
					<xs:documentation>An application has been received and is pending confirmation out-of-band.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Rejected'>
				<xs:annotation>
					<xs:documentation>The legal identity has been rejected.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Approved'>
				<xs:annotation>
					<xs:documentation>The legal identity is authenticated and approved by the Trust Provider.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Obsoleted'>
				<xs:annotation>
					<xs:documentation>The legal identity has been explicitly obsoleted by its owner, or by the Trust Provider.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Compromised'>
				<xs:annotation>
					<xs:documentation>The legal identity has been reported compromised by its owner, or by the Trust Provider.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>

	<xs:element name='getLegalIdentities'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq get to a Trust Provider, to retrieve a list (possibly empty) of legal identities registered with the provider.</xs:documentation>
			<xs:documentation>Expected response element: identities</xs:documentation>
		</xs:annotation>
		<xs:complexType>
		</xs:complexType>
	</xs:element>

	<xs:element name='identities'>
		<xs:annotation>
			<xs:documentation>Contains a set of legal identities.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref='identity' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>A legal identity.</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name='getLegalIdentity'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq get to a Trust Provider, to retrieve a specific legal identity given its ID.</xs:documentation>
			<xs:documentation>The server should only return the legal identity if the client is authorized access.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
			<xs:documentation>Note: To get the legal identity from a signature, see validateSignature.</xs:documentation>
			<xs:documentation>Note: To get the legal identities related to contracts, see getLegalIdentities element in the smart contracts namespace.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the legal identity to retrieve.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='validateSignature'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq get to a Trust Provider, to validate a client signature from a legal identity hosted by the provider.</xs:documentation>
			<xs:documentation>If valid, the information about the corresponding legal identity is returned.</xs:documentation>
			<xs:documentation>If signature is not valid, a forbidden error will be returned.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
			<xs:documentation>Note: If neither id or bareJid are provided, current approved legal identities for the sender will be used to verify the signature.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='for' type='xs:string' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Contains a Bare JID of an entity for which the signature was presented.</xs:documentation>
						<xs:documentation>During Identity Petitions, this element is used to identify the Bare JID associated with the requested Identity, authorizing it access to the requestor's Identity if signature is valid.</xs:documentation>
						<xs:documentation>During Contract Petitions, this element is used once for each Bare JID associated with a part in the contract, authorizing them access to the requestor's Identity if signature is valid.</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
			<xs:attribute name='id' type='xs:string' use='optional'>
				<xs:annotation>
					<xs:documentation>Identifier of the legal identity to retrieve.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='bareJid' type='xs:string' use='optional'>
				<xs:annotation>
					<xs:documentation>Bare JID of account on the Trust Provider.</xs:documentation>
					<xs:documentation>Current approved legal identities for this account will be used to verify the signature.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='data' type='xs:base64Binary' use='required'>
				<xs:annotation>
					<xs:documentation>Binary data claimed to be signed.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="s" type="xs:base64Binary" use="required">
				<xs:annotation>
					<xs:documentation>Digital signature to validate.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='obsoleteLegalIdentity'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider, to obsolete one of its legal identities.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the legal identity to obsolete.</xs:documentation>
					<xs:documentation>Note: Obsoleting an application automatically turns it to Rejected.</xs:documentation>
					<xs:documentation>Note: Trying to obsolete a rejected or compromised identity returns a forbidden error.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='compromisedLegalIdentity'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider, to report one of its legal identities as compromised.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the legal identity to report as compromised.</xs:documentation>
					<xs:documentation>Note: Reporting an application as compromised automatically turns it to Rejected.</xs:documentation>
					<xs:documentation>Note: Trying to report a rejected identity as compromised returns a forbidden error.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='petitionIdentity'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider to petition for the information related to a legal identity managed by the Trust Provider.</xs:documentation>
			<xs:documentation>The request must be signed using an approved and valid legal identity of the caller. Invalid requests must be rejected.</xs:documentation>
			<xs:documentation>The Trust Provider will forward the petition to the corresponding client(s) using a normal message containing a petitionIdentityMsg element.</xs:documentation>
			<xs:documentation>Expect an empty response on success.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='PetitionRequest'>
					<xs:attribute name='id' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Identifier of the legal identity hosted by the Trust Provider, to which the caller requests access.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:complexType name='Petition' abstract='true'>
		<xs:sequence>
			<xs:element name='properties' minOccurs='0' maxOccurs='1'>
				<xs:annotation>
					<xs:documentation>Optional element specifying what properties will be forwarded to party making the request.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name='property' type='xs:string' minOccurs='0' maxOccurs='unbounded'>
							<xs:annotation>
								<xs:documentation>Name of one property that will be forwarded.</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name='attachments' minOccurs='0' maxOccurs='1'>
				<xs:annotation>
					<xs:documentation>Optional element specifying what attachments will be forwarded to party making the request.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name='attachment' type='xs:string' minOccurs='0' maxOccurs='unbounded'>
							<xs:annotation>
								<xs:documentation>Name of one attachment that will be forwarded, without file extension.</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name='pid' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>A petition ID. This identity will follow the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='purpose' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>A string containing the purpose of the request. This string can be shown to the owner of the identity.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name='PetitionRequest' abstract='true'>
		<xs:complexContent>
			<xs:extension base='Petition'>
				<xs:attribute name='nonce' type='xs:string' use='required'>
					<xs:annotation>
						<xs:documentation>A nonce value, generated by a cryptographic pseudo random number generator.</xs:documentation>
						<xs:documentation>Used to introduce sufficient entropy in the request.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
				<xs:attribute name='s' type='xs:base64Binary' use='required'>
					<xs:annotation>
						<xs:documentation>Digital signature of the request using the legal identity (or one of the approved legal identities) of the caller.</xs:documentation>
						<xs:documentation>The signature is calculated on the following data: UTF8Encode(pid + ":" + id + ":" + purpose + ":" + nonce + ":" + lowercase(fromBareJid)), where fromBareJid is the Bare JID of the sender.</xs:documentation>
						<xs:documentation>Note: If a sender has multiple approved legal identities associated with it, the Trust Provider uses the signature to identify which identity has been used to form the signature. It is this identity that is later forwarded to the owner of the requested identity.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<xs:complexType name='PetitionMessage'>
		<xs:complexContent>
			<xs:extension base='Petition'>
				<xs:sequence>
					<xs:element ref='identity' minOccurs='1' maxOccurs='1'>
						<xs:annotation>
							<xs:documentation>The legal identity of the entity making the petition.</xs:documentation>
							<xs:documentation>This information can be used by the recipient of the message to make an informed decision on wether to accept, deny or ignore the request.</xs:documentation>
						</xs:annotation>
					</xs:element>
					<xs:any minOccurs='0' maxOccurs='1' namespace='##other' processContents='skip'>
						<xs:annotation>
							<xs:documentation>Optional element that can provide machine-readable context for petition.</xs:documentation>
						</xs:annotation>
					</xs:any>
				</xs:sequence>
				<xs:attribute name='id' type='xs:string' use='required'>
					<xs:annotation>
						<xs:documentation>Identifier of the legal identity referred to by the petition.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
				<xs:attribute name='from' type='xs:string' use='required'>
					<xs:annotation>
						<xs:documentation>The Bare JID of the entity requesting the information.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
				<xs:attribute name='clientEp' type='xs:string' use='optional'>
					<xs:annotation>
						<xs:documentation>The remote endpoint of the entity requesting the information.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<xs:element name='petitionIdentityMsg' type='PetitionMessage'>
		<xs:annotation>
			<xs:documentation>Sent in a normal message stanza from a Trust Provider to a client, when the Trust Provider has received a petition for a legal identity owned by the recipient of this message.</xs:documentation>
			<xs:documentation>The recipient can choose to ignore the message, and respond in its own time, sending an petitionIdentityResponse element with the response in an IQ set stanza back to the Trust Provider.</xs:documentation>
		</xs:annotation>
	</xs:element>

	<xs:element name='petitionIdentityResponse' type='PetitionResponse'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider as an active response to a previous petition for information related to a legal identity owned by the client.</xs:documentation>
			<xs:documentation>Expect an empty response on success.</xs:documentation>
			<xs:documentation>A successfull request will forward the response, and the referenced legal identity if approved, to the entity making the request, by sending a petitionIdentityResponseMsg element in a normal message stanza.</xs:documentation>
		</xs:annotation>
	</xs:element>

	<xs:complexType name='PetitionResponse'>
		<xs:sequence>
			<xs:any minOccurs='0' maxOccurs='1' namespace='##other' processContents='skip'>
				<xs:annotation>
					<xs:documentation>Optional element that can provide machine-readable context for petition response.</xs:documentation>
				</xs:annotation>
			</xs:any>
		</xs:sequence>
		<xs:attribute name='id' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Identifier of the legal identity referred to by the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='pid' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>A petition ID. This identity will follow the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='jid' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Bare JID of the entity making the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='response' type='xs:boolean' use='optional' default='false'>
			<xs:annotation>
				<xs:documentation>If the Trust Provider can share the legal identity information with the entity making the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:element name='petitionIdentityResponseMsg' type='PetitionResponseMessage'>
		<xs:annotation>
			<xs:documentation>Sent in a normal message stanza from a Trust Provider to a client, when the Trust Provider has received a response on a petition made by the client for a legal identity.</xs:documentation>
		</xs:annotation>
	</xs:element>

	<xs:complexType name='PetitionResponseMessage'>
		<xs:sequence>
			<xs:element ref='identity' minOccurs='0' maxOccurs='1'>
				<xs:annotation>
					<xs:documentation>The legal identity requested, if available, and the owner of the identity consented in sharing the information.</xs:documentation>
					<xs:documentation>This information must only be used for the purposes described in the original petition.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:any minOccurs='0' maxOccurs='1' namespace='##other' processContents='skip'>
				<xs:annotation>
					<xs:documentation>Optional element that can provide machine-readable context for petition response.</xs:documentation>
				</xs:annotation>
			</xs:any>
		</xs:sequence>
		<xs:attribute name='pid' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>A petition ID. This identity will follow the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='response' type='xs:boolean' use='required'>
			<xs:annotation>
				<xs:documentation>If the Trust Provider can share the legal identity information with the entity making the petition.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='clientEp' type='xs:string' use='optional'>
			<xs:annotation>
				<xs:documentation>The remote endpoint of the entity responding to the information, if response is positive.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:element name='petitionSignature'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider to petition a client for a digital signature.</xs:documentation>
			<xs:documentation>The request must be signed using an approved and valid legal identity of the caller. Invalid requests must be rejected.</xs:documentation>
			<xs:documentation>The Trust Provider will forward the petition to the corresponding client(s) using a normal message containing a petitionSignatureMsg element.</xs:documentation>
			<xs:documentation>Expect an empty response on success.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='PetitionRequest'>
					<xs:sequence>
						<xs:element name='content' type='xs:base64Binary' minOccurs='1' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>BASE64-encoded binary string that the recipient of the signature is requested to sign, if approving the request.</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:any minOccurs='0' maxOccurs='1' namespace='##other' processContents='skip'>
							<xs:annotation>
								<xs:documentation>Optional element that can provide machine-readable context for petition.</xs:documentation>
							</xs:annotation>
						</xs:any>
					</xs:sequence>
					<xs:attribute name='id' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Identifier of the legal identity hosted by the Trust Provider, from which the caller requests a digital signature.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:element name='petitionSignatureMsg'>
		<xs:annotation>
			<xs:documentation>Sent in a normal message stanza from a Trust Provider to a client, when the Trust Provider has received a petition for a digital signature from the recipient of this message.</xs:documentation>
			<xs:documentation>The recipient can choose to ignore the message, and respond in its own time, sending an petitionSignatureResponse element with the response in an IQ set stanza back to the Trust Provider.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='PetitionMessage'>
					<xs:sequence>
						<xs:element name='content' type='xs:base64Binary' minOccurs='1' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>BASE64-encoded binary string that the recipient of the signature is requested to sign, if approving the request.</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:element name='petitionSignatureResponse'>
		<xs:annotation>
			<xs:documentation>Sent by a client in an iq set to a Trust Provider as an active response to a previous petition for information related to a legal identity owned by the client.</xs:documentation>
			<xs:documentation>Expect an empty response on success.</xs:documentation>
			<xs:documentation>A successfull request will forward the response, and the referenced legal identity if approved, to the entity making the request, by sending a petitionSignatureResponseMsg element in a normal message stanza.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='PetitionResponse'>
					<xs:sequence>
						<xs:element name='content' type='xs:base64Binary' minOccurs='0' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>BASE64-encoded binary string that the recipient of the signature is requested to sign, if approving the request.</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name='signature' type='xs:base64Binary' minOccurs='0' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>BASE64-encoded binary signature of the content, if approving the request.</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:element name='petitionSignatureResponseMsg'>
		<xs:annotation>
			<xs:documentation>Sent in a normal message stanza from a Trust Provider to a client, when the Trust Provider has received a response on a petition made by the client for a digital signature.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='PetitionResponseMessage'>
					<xs:sequence>
						<xs:element name='content' type='xs:base64Binary' minOccurs='0' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>BASE64-encoded binary string that the recipient of the signature is requested to sign, if approving the request.</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name='signature' type='xs:base64Binary' minOccurs='0' maxOccurs='1'>
							<xs:annotation>
								<xs:documentation>BASE64-encoded binary signature of the content, if approving the request.</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:element name='petitionClientUrl'>
		<xs:annotation>
			<xs:documentation>Sent by a broker to a client petitioning a peer review signature from a peer review service.</xs:documentation>
			<xs:documentation>The message identifies the petition, and provides an URL the client needs to open to complete the petition request.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='pid' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the petition causing the message to be sent.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='url' type='xs:anyURI' use='required'>
				<xs:annotation>
					<xs:documentation>The URL the client needs to open, to complete the petition.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='addAttachment'>
		<xs:annotation>
			<xs:documentation>Sent in an iq set stanza from a client to a Trust Provider, to add an attachment to a legal identity that is yet to be approved.</xs:documentation>
			<xs:documentation>Attachments can be photos, documents, or other types of objects that have a well-defined Internet Content Type.</xs:documentation>
			<xs:documentation>The contents of the attachment may have been uploaded to the Trust Provider using HTTP File Upload (XEP-0363) before this command is sent.</xs:documentation>
			<xs:documentation>After the file has been registered as an attachment, it must be removed, after first giving time for lost messages and retries, from the temporary storage of the HTTP File Upload service by the Trust Provider, for privacy reasons.</xs:documentation>
			<xs:documentation>Access privileges to legal identities or smart contracts, automatically infer access privileges to any attachments associated with them.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Legal identity to which the attachment is to be assigned.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='getUrl' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>The URL of the content. It may previously have been uploaded using HTTP File Upload (XEP-0363).</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='s' type='xs:base64Binary' use='required'>
				<xs:annotation>
					<xs:documentation>Signature of the content assigned to the legal identity.</xs:documentation>
					<xs:documentation>The signature must be made by the private key of the legal identity to which the attachment is to be assigned.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='removeAttachment'>
		<xs:annotation>
			<xs:documentation>Sent in an iq set stanza from a client to a Trust Provider, to remove an attachment from a legal identity that is yet to be approved.</xs:documentation>
			<xs:documentation>A client can only remove attachments from its own identities.</xs:documentation>
			<xs:documentation>Expected response element: identity</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='attachmentId' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identity of attachment to remove.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='attachment'>
		<xs:annotation>
			<xs:documentation>Represents an attachment.</xs:documentation>
			<xs:documentation>An attachment can	be assigned to legal identities.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>The identity of the attachment.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='contentType' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Internet Content-Type of attachment.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='fileName' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Filename of attachment.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='s' type='xs:base64Binary' use='required'>
				<xs:annotation>
					<xs:documentation>Signature of attachment, made by the uploader.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='timestamp' type='xs:dateTime' use='required'>
				<xs:annotation>
					<xs:documentation>Timestamp of attachment upload.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='attachmentRef'>
		<xs:annotation>
			<xs:documentation>Includes information on how to download an attachment.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='attachmentId' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>The ID of the attachment referenced to.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='url' type='xs:anyURI' use='required'>
				<xs:annotation>
					<xs:documentation>An URL to download the attachment.</xs:documentation>
					<xs:documentation>Attachments must be protected using the NeuroFoundation.Sign WWW-authentication mechanism to make sure only authorized clients can access the attachment.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='getNetworkIdentity'>
		<xs:annotation>
			<xs:documentation>Sent in an iq get stanza from one	Broker or Legal Component to another Broker or Legal Component, to get the network identity of an identifier (Legal Identity or Account).</xs:documentation>
			<xs:documentation>If a client sends this request, a forbidden error is returned.</xs:documentation>
			<xs:documentation>Expected response element: networkIdentity</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the Legal Identity or Account to get the network address to.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='networkIdentity'>
		<xs:annotation>
			<xs:documentation>Sent in an iq result stanza as a response to a getNetworkIdentity request.</xs:documentation>
			<xs:documentation>Contains information about the Bare JID of an identifier, and any associated connections currently open.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='connection' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Represents an active connection.</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:attribute name='clientEp' type='xs:string' use='required'>
							<xs:annotation>
								<xs:documentation>Representation of the remote endpoint of the connection.</xs:documentation>
								<xs:documentation>Format and syntax of remote endpoint depend on binding and transport used for the connection. My be a remote IP-address of a socket connection, for example.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name='ts' type='xs:dateTime' use='required'>
							<xs:annotation>
								<xs:documentation>Timestamp (in UTC) of last presence stanza sent by client.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name='jid' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Bare JID associated with identifier.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='authorizeAccess'>
		<xs:annotation>
			<xs:documentation>Sent in an iq set stanza from a client to a Trust Provider, to add or remove authorization to access one of its Legal Identities.</xs:documentation>
			<xs:documentation>A client can only control authorization to its own identities.</xs:documentation>
			<xs:documentation>An empty response is expected to be returned, to acknowledge the request.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the Legal Identity to authorize access to.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='remoteId' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Remote ID, either a Legal Identity identifier or a Bare JID.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='auth' type='xs:boolean' use='optional' default='true'>
				<xs:annotation>
					<xs:documentation>If true, authorizes access to the identity to the remote ID.</xs:documentation>
					<xs:documentation>If false, removes authorization to access the identity from the remote ID.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='canSignAs'>
		<xs:annotation>
			<xs:documentation>Sent in an iq get stanza from a client to a Trust Provider, to check if a new Legal Identity can sign using the same Conceptual Identity as an obsoleted or compromized Legal Identity.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='referenceId' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the obsoleted or compromized Legal Identity.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='signatoryId' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the new Legal Identity.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='readyForApproval'>
		<xs:annotation>
			<xs:documentation>Sent in an iq set stanza from a client to a Trust Provider, to tell the Broker that Identity Authenticator services can initiate processing of the applcation.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='id' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of the Legal Identity that is ready for approval.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='reviewIdProviders'>
		<xs:annotation>
			<xs:documentation>Sent in an iq get stanza from a client to a Trust Provider, to get a list of available Peer Review Service Providers on the broker.</xs:documentation>
			<xs:documentation>Expected response element: providers</xs:documentation>
		</xs:annotation>
		<xs:complexType/>
	</xs:element>

	<xs:element name='providers'>
		<xs:annotation>
			<xs:documentation>Contains a list (possibly empty) of service providers.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='provider' type='Provider' minOccurs='0' maxOccurs='unbounded'>
					<xs:annotation>
						<xs:documentation>Contains a reference to one service provider.</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:complexType name='Provider'>
		<xs:attribute name='id' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Identifier of the service provider.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='type' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Implementation-specific type name of the service provider.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='name' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Displayable name of the service provider.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='legalId' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Legal Identity identifier to invoke, if requesting Peer Review from the service.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='external' type='xs:boolean' use='required'>
			<xs:annotation>
				<xs:documentation>If the service is external (true) or runs internally in the broker (false).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='iconUrl' type='xs:anyURI' use='optional'>
			<xs:annotation>
				<xs:documentation>Optional URL to an icon that can be presented for the service provider.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='iconWidth' type='xs:positiveInteger' use='optional'>
			<xs:annotation>
				<xs:documentation>Width, in pixels, of the optional icon, if provided.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name='iconHeight' type='xs:positiveInteger' use='optional'>
			<xs:annotation>
				<xs:documentation>Height, in pixels, of the optional icon, if provided.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:element name='selectReviewService'>
		<xs:annotation>
			<xs:documentation>Selects a Peer Review service. Sent in an iq set stanza.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name='provider' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Type of Peer Review service to select.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='serviceId' type='xs:string' use='required'>
				<xs:annotation>
					<xs:documentation>Identifier of Peer Review service to select.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='clientMessage'>
		<xs:annotation>
			<xs:documentation>Contains information message about an identity application.</xs:documentation>
			<xs:documentation>The default message text is available in the message body, not in the element itself.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='IdentityApplicationResult'>
					<xs:attribute name='code' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>A machine-readable code corresponding to the message for localization purposes.</xs:documentation>
							<xs:documentation>Different services can use their own different codes.</xs:documentation>
							<xs:documentation>If a code is not recognized, the default message should be displayed.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='type' type='ValidationErrorType' use='required'>
						<xs:annotation>
							<xs:documentation>Type of validation error message.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:element name='peerReview'>
		<xs:annotation>
			<xs:documentation>Contains information about a peer review of an identity application.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='reviewed'>
					<xs:complexType>
						<xs:sequence>
							<xs:element ref='identity' minOccurs='1' maxOccurs='1'>
								<xs:annotation>
									<xs:documentation>Legal Identity being reviewed.</xs:documentation>
								</xs:annotation>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name='reviewer'>
					<xs:complexType>
						<xs:sequence>
							<xs:element ref='identity' minOccurs='1' maxOccurs='1'>
								<xs:annotation>
									<xs:documentation>Legal Identity of the reviewer.</xs:documentation>
								</xs:annotation>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name='s' type='xs:base64Binary' use='required'>
				<xs:annotation>
					<xs:documentation>Signature of the peer review, made by the reviewer.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name='tp' type='xs:dateTime' use='required'>
				<xs:annotation>
					<xs:documentation>Timestamp (in UTC) when the peer review was received.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<xs:element name='identityReview'>
		<xs:annotation>
			<xs:documentation>Contains information about an identity review.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base='IdentityApplicationResult'/>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

	<xs:complexType name='IdentityApplicationResult'>
		<xs:annotation>
			<xs:documentation>Contains detailed information about the processing of an identity application.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name='invalidClaim' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a claim that was determined invalid.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='claim' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Identity claim key.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='message' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Default message text explaining the reason for invalidating the claim.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='code' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>A machine-readable key for localization of message text.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='service' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>Reference to service where message originated.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='invalidPhoto' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a photo that was determined invalid.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='fileName' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>File name of photo.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='message' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Default message text explaining the reason for invalidating the photo.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='code' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>A machine-readable key for localization of message text.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='service' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>Reference to service where message originated.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='error' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a processing error.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name='tag' minOccurs='0' maxOccurs='unbounded'>
							<xs:complexType>
								<xs:attribute name='name' type='xs:string' use='required'>
									<xs:annotation>
										<xs:documentation>Name of a meta-data tag.</xs:documentation>
									</xs:annotation>
								</xs:attribute>
								<xs:attribute name='value' type='xs:string' use='optional'>
									<xs:annotation>
										<xs:documentation>Value of a meta-data tag.</xs:documentation>
										<xs:documentation>A missing value is considered a null value.</xs:documentation>
									</xs:annotation>
								</xs:attribute>
								<xs:attribute name='type' type='xs:string' use='optional'>
									<xs:annotation>
										<xs:documentation>XML Data Type of the encoded value in the value attribute.</xs:documentation>
									</xs:annotation>
								</xs:attribute>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					<xs:attribute name='message' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Default message text explaining the reason for the error.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='type' type='ValidationErrorType' use='required'>
						<xs:annotation>
							<xs:documentation>Type of validation error message.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='code' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>A machine-readable key for localization of message text.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='service' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>Reference to service where message originated.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='validatedClaim' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a claim that was determined valid.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='claim' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Identity claim key.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='service' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>Reference to service validating claim.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='validatedPhoto' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a photo that was determined valid.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='fileName' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>File name of photo.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='service' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>Reference to service validating photo.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='potentialClaim' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a potential claim that the client can make in a subsequent application.</xs:documentation>
					<xs:documentation>Potential claims should only be provided if in the context of other claims, the potential claims are assumed to be validated, and therefore, do not leak sensitive personal information to the client.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='claim' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Identity claim key.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='value' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Value of potential claim.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
					<xs:attribute name='service' type='xs:string' use='optional'>
						<xs:annotation>
							<xs:documentation>Reference to service where potential claim originated.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='unvalidatedClaim' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a claim that has not been processed for validation.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='claim' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>Identity claim key.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element name='unvalidatedPhoto' minOccurs='0' maxOccurs='unbounded'>
				<xs:annotation>
					<xs:documentation>Contains information about a photo that has not been processed for validation.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:attribute name='fileName' type='xs:string' use='required'>
						<xs:annotation>
							<xs:documentation>File name of photo.</xs:documentation>
						</xs:annotation>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name='id' type='xs:string' use='required'>
			<xs:annotation>
				<xs:documentation>Identifier of the referenced legal identity.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:simpleType name='ValidationErrorType'>
		<xs:restriction base='xs:string'>
			<xs:enumeration value='Client'>
				<xs:annotation>
					<xs:documentation>Error caused by the client.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Server'>
				<xs:annotation>
					<xs:documentation>Error caused by the server.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value='Service'>
				<xs:annotation>
					<xs:documentation>Error caused by a service.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>

	<xs:element name='getTrustChain'>
		<xs:annotation>
			<xs:documentation>Sent by one entity to another when it needs to get the chain of trust of a broker.</xs:documentation>
			<xs:documentation>Expected response element: trustChain</xs:documentation>
		</xs:annotation>
		<xs:complexType/>
	</xs:element>

	<xs:element name='trustChain'>
		<xs:annotation>
			<xs:documentation>Sent in response to a request of a brokers trust chain.</xs:documentation>
			<xs:documentation>Contains a sequence of parent brokers, from the trust anchor (root) down to the broker itself.</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name='broker' minOccurs='1' maxOccurs='unbounded'>
					<xs:complexType>
						<xs:attribute name='domain' use='required' type='xs:string'>
							<xs:annotation>
								<xs:documentation>The domain name of the broker.</xs:documentation>
							</xs:annotation>
						</xs:attribute>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name='verifyTrustLink'>
		<xs:annotation>
			<xs:documentation>Sends a message using the parent connection of the Broker, to the sender of the request, to verify a Trust Link.</xs:documentation>
			<xs:documentation>Can be sent in an iq set stanza to initiate verification.</xs:documentation>
			<xs:documentation>Can be sent in a message stanza back to the sender of the request, to verify a tr