-
Notifications
You must be signed in to change notification settings - Fork 4
/
GPGUserID.h
186 lines (159 loc) · 5.56 KB
/
GPGUserID.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//
// GPGUserID.h
// MacGPGME
//
// Created by davelopper at users.sourceforge.net on Fri Dec 27 2002.
//
//
// Copyright (C) 2001-2006 Mac GPG Project.
//
// This code is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 2.1 of the License, or (at your option)
// any later version.
//
// This code is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, visit <http://www.gnu.org/> or write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
// MA 02111-1307, USA.
//
// More info at <http://macgpg.sourceforge.net/>
//
#ifndef GPGUSERID_H
#define GPGUSERID_H
#include <MacGPGME/GPGObject.h>
#include <MacGPGME/GPGKey.h>
#ifdef __cplusplus
extern "C" {
#if 0 /* just to make Emacs auto-indent happy */
}
#endif
#endif
@class GPGKeySignature;
/*!
* @class GPGUserID
* @abstract A <i>user ID</i> is a component of a <code>@link //macgpg/occ/cl/GPGKey GPGKey@/link</code>
* object.
* @discussion A <i>user ID</i> is a component of a <code>@link //macgpg/occ/cl/GPGKey GPGKey@/link</code>
* object. One key can have many <i>user IDs</i>. The first one in
* the list is the <i>main</i> (or <i>primary</i>) user ID. It is
* guaranteed that the owning <code>@link //macgpg/occ/cl/GPGKey GPGKey@/link</code>
* objects will never be deallocated before the GPGUserID has
* been deallocated, without creating non-breakable
* retain-cycles.
*
* A <i>user ID</i> represents an identity associated with a key.
* This identity is generally composed of a name and an email
* adress, and can have a comment associated.
*
* The signatures on a key (actually on a <i>user ID</i>) are only
* available if the key was retrieved via a listing operation with
* the <code>@link //macgpg/c/econst/GPGKeyListModeSignatures GPGKeyListModeSignatures@/link</code>
* mode enabled, because it is expensive to retrieve all signatures
* of a key.
*/
@interface GPGUserID : GPGObject <NSCopying>
{
GPGKey *_key; // Key owning the user ID; not retained
NSArray *_signatures; // Signatures on the user ID
int _refCount;
}
/*!
* @method copyWithZone:
* @abstract Implementation of <code>@link //apple_ref/occ/intf/NSCopying NSCopying@/link</code>
* protocol. Returns itself, retained.
* @discussion GPGUserID objects are (currently) immutable.
* @param zone Memory zone (unused)
*/
- (id) copyWithZone:(NSZone *)zone;
/*!
* @method description
* @abstract Returns <code>@link //macgpg/occ/instm/GPGUserID/userID userID@/link</code>.
* @seealso userID
*/
- (NSString *) description;
/*!
* @method userID
* @abstract Returns a user-presentable description using format
* "Name (Comment) <Email>".
* @discussion Elements which are nil are not used for output.
*/
- (NSString *) userID;
/*!
* @method key
* @abstract Returns the key owning the <i>user ID</i>.
* @discussion Never returns nil, as a GPGUserID is always owned by a
* <code>@link //macgpg/occ/cl/GPGKey GPGKey@/link</code>.
*/
- (GPGKey *) key;
/*!
* @methodgroup Attributes
*/
/*!
* @method name
* @abstract Returns the <i>user ID</i> name.
* @discussion May return nil when there is no name.
*/
- (NSString *) name;
/*!
* @method comment
* @abstract Returns the <i>user ID</i> comment.
* @discussion May return nil when there is no comment.
*/
- (NSString *) comment;
/*!
* @method email
* @abstract Returns the <i>user ID</i> email address.
* @discussion May return nil when there is no email.
*/
- (NSString *) email;
/*!
* @method validity
* @abstract Returns the <i>user ID</i> validity.
* @discussion Note that for secret keys, validity is currently meaningless and
* always set to <code>@link //macgpg/c/econst/GPGValidityUnknown GPGValidityUnknown@/link</code>.
* This will be fixed with <code>gpg</code> >= 1.9.
*/
- (GPGValidity) validity;
/*!
* @method hasBeenRevoked
* @abstract Returns whether the <i>user ID</i> has been revoked or not.
*/
- (BOOL) hasBeenRevoked;
/*!
* @method isInvalid
* @abstract Returns whether the <i>user ID</i> is invalid or not.
*/
- (BOOL) isInvalid;
/*!
* @methodgroup Convenience methods
*/
/*!
* @method validityDescription
* @abstract Returns a localized string describing the <i>user ID</i>
* validity.
*/
- (NSString *) validityDescription;
/*!
* @methodgroup Signatures
*/
/*!
* @method signatures
* @abstract Returns the signatures on the <i>user ID</i>.
* @discussion Returns the signatures on the <i>user ID</i>, <strong>if</strong>
* they have been fetched. Array contains <code>@link //macgpg/occ/cl/GPGKeySignature GPGKeySignature@/link</code> objects.
*
* Returns nil if signatures have not been fetched.
* @seealso //macgpg/c/econst/GPGKeyListModeSignatures GPGKeyListModeSignatures
*/
- (NSArray *) signatures;
@end
#ifdef __cplusplus
}
#endif
#endif /* GPGUSERID_H */