1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use crate::{
    AuthenticationProof, Changes, Contact, Credential, CredentialAttribute, CredentialFragment1,
    CredentialFragment2, CredentialOffer, CredentialPresentation, CredentialProof,
    CredentialPublicKey, CredentialRequest, CredentialSchema, OfferId, PresentationManifest,
    ProfileChangeEvent, ProfileIdentifier, ProofRequestId,
};
use ockam_core::{Address, Route};
use serde::{Deserialize, Serialize};

pub type EventAttribute = (String, String);
pub type EventAttributes = Vec<EventAttribute>;
pub type ByteVec = Vec<u8>;
pub type Id = ProfileIdentifier;

#[derive(Clone, Serialize, Deserialize)]
pub enum IdentityRequest {
    CreateProfile,
    CreateAuthenticationProof(Id, ByteVec),
    CreateKey(Id, String),
    GetProfilePublicKey(Id),
    GetProfileSecretKey(Id),
    GetPublicKey(Id, String),
    GetSecretKey(Id, String),
    GetChanges(Id),
    GetContacts(Id),
    GetContact(Id, Id),
    RotateKey(Id),
    AddChange(Id, ProfileChangeEvent),
    VerifyAuthenticationProof(Id, ByteVec, Id, AuthenticationProof),
    VerifyChanges(Id),
    VerifyAndAddContact(Id, Contact),
    VerifyContact(Id, Contact),
    VerifyAndUpdateContact(Id, Id, Changes),
    RemoveProfile(Id),
    CreateSecureChannelListener(Id, Address),
    CreateSecureChannel(Id, Route),
    GetSigningKey(Id),
    GetIssuerPublicKey(Id),
    CreateOffer(Id, CredentialSchema),
    CreateProofOfPossession(Id),
    SignCredential(Id, CredentialSchema, Vec<CredentialAttribute>),
    SignCredentialRequest(
        Id,
        CredentialRequest,
        CredentialSchema,
        Vec<(String, CredentialAttribute)>,
        OfferId,
    ),
    AcceptCredentialOffer(Id, CredentialOffer, CredentialPublicKey),
    CombineCredentialFragments(Id, CredentialFragment1, CredentialFragment2),
    IsValidCredential(Id, Credential, CredentialPublicKey),
    PresentCredential(Id, Credential, PresentationManifest, ProofRequestId),
    CreateProofRequestId(Id),
    VerifyProofOfPossession(Id, CredentialPublicKey, CredentialProof),
    VerifyCredentialPresentation(
        Id,
        CredentialPresentation,
        PresentationManifest,
        ProofRequestId,
    ),
}