@@ -31,6 +31,12 @@ type User struct {
31
31
ServerPublicKey string `json:"server_public_key"`
32
32
}
33
33
34
+ type UserMeView struct {
35
+ User
36
+ SessionId string `json:"session_id"`
37
+ HasPIN bool `json:"has_pin"`
38
+ }
39
+
34
40
type Membership struct {
35
41
Plan string `json:"plan"`
36
42
ExpiredAt time.Time `json:"expired_at"`
@@ -223,14 +229,14 @@ func UpdatePin(ctx context.Context, oldEncryptedPin, encryptedPin string, su *Sa
223
229
return nil
224
230
}
225
231
226
- func UserMeWithRequestID (ctx context.Context , accessToken , requestID string ) (* User , error ) {
232
+ func UserMeWithRequestID (ctx context.Context , accessToken , requestID string ) (* UserMeView , error ) {
227
233
body , err := RequestWithId (ctx , "GET" , "/safe/me" , nil , accessToken , requestID )
228
234
if err != nil {
229
235
return nil , ServerError (ctx , err )
230
236
}
231
237
var resp struct {
232
- Data * User `json:"data"`
233
- Error Error `json:"error"`
238
+ Data * UserMeView `json:"data"`
239
+ Error Error `json:"error"`
234
240
}
235
241
err = json .Unmarshal (body , & resp )
236
242
if err != nil {
@@ -242,11 +248,11 @@ func UserMeWithRequestID(ctx context.Context, accessToken, requestID string) (*U
242
248
return resp .Data , nil
243
249
}
244
250
245
- func UserMe (ctx context.Context , accessToken string ) (* User , error ) {
251
+ func UserMe (ctx context.Context , accessToken string ) (* UserMeView , error ) {
246
252
return UserMeWithRequestID (ctx , accessToken , UuidNewV4 ().String ())
247
253
}
248
254
249
- func RequestUserMe (ctx context.Context , su * SafeUser ) (* User , error ) {
255
+ func RequestUserMe (ctx context.Context , su * SafeUser ) (* UserMeView , error ) {
250
256
path := "/safe/me"
251
257
token , err := SignAuthenticationToken ("GET" , path , "" , su )
252
258
if err != nil {
0 commit comments