OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 module mojo; | |
6 | |
7 // Represents the name of an application. |url| is the url of the | |
8 // application. |qualifier| is a string that allows to tie a specific | |
9 // instance of an application to another. | |
10 struct AppInstanceName { | |
jamesr
2015/08/11 21:55:08
this doesn't appear to be used anywhere. Where is
gauthamt
2015/08/11 22:21:20
This is used to in the bank example. A service wou
| |
11 string url; | |
12 string? qualifier; | |
13 }; | |
14 | |
15 // Signature represents a digital signature of a message. | |
16 struct Signature { | |
17 // Purpose of the signature. Can be used to prevent type attacks. | |
18 // The actual signature (R, S values for ECDSA keys) is produced by signing | |
19 // Hash(Hash(message), Hash(Purpose)). | |
20 array<uint8> purpose; | |
21 // Cryptographic hash function applied to the message before computing | |
22 // the signature. | |
23 enum Hash { | |
24 SHA1Hash = 1, | |
25 SHA256Hash, | |
26 SHA384Hash, | |
27 SHA512Hash, | |
28 }; | |
29 Hash hash; | |
30 // Pair of integers that make up an ECDSA signature | |
31 array<uint8> r; | |
32 array<uint8> s; | |
33 }; | |
34 | |
35 // Certificate represents a human-readable name and public-key pair. The private -key | |
36 // for a certificate is only available for signing operations within the princip al | |
37 // service application. | |
38 struct Certificate { | |
39 string extension; | |
40 array<uint8>? publickey; | |
41 }; | |
42 | |
43 // Blessing is a credential binding a user identity to a public key. The corresp onding | |
44 // private key is only available for signing within the PrincipalService applica tion. | |
45 struct Blessing { | |
46 array<Certificate> chain; | |
47 }; | |
48 | |
49 // A service that binds user identities to an application instance running in Mo jo | |
50 interface PrincipalService { | |
51 // Login is called by an application instance (requestor_url/qualifier) that | |
52 // wants to get a user blessing. The service may obtain the user blessing | |
53 // through a third-party authentication flow (eg:oauth2). The user blessing | |
54 // is bound to a public/private key-pair that this service generates and | |
55 // persists for this application instance. Returns null if login fails. | |
56 Login() => (Blessing? user_blessing); | |
57 | |
58 // Removes the user blessing for the application instance that invokes the | |
59 // Logout method. | |
60 Logout(); | |
61 | |
62 // Sign returns a signature on the message using the private key that is | |
63 // persisted for this application instance. | |
64 Sign(array<uint8> message) => (Signature? signature); | |
65 | |
66 // GetUserBlessing returns the user blessing for a given application instance. | |
67 // It returns an error if the application instance has not invoked Login(). | |
68 GetUserBlessing(AppInstanceName app) => (Blessing? user_blessing); | |
69 }; | |
70 | |
OLD | NEW |