Chromium Code Reviews| 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 AppName { | |
|
ataly
2015/07/31 19:04:04
Should this be called "AppInstanceName"?
(In the c
gauthamt
2015/07/31 20:24:16
Done.
| |
| 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/public-key pair. The private-key | |
|
ataly
2015/07/31 19:04:04
Nit: we should say human-readable name and public-
gauthamt
2015/07/31 20:24:16
Done.
| |
| 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 represents a user identity. | |
|
ataly
2015/07/31 19:04:04
How about changing the comment to:
// Blessing is
gauthamt
2015/07/31 20:24:16
Done.
I'd left out binding before as we don't rea
| |
| 44 struct Blessing { | |
| 45 array<Certificate> chain; | |
| 46 }; | |
| 47 | |
| 48 // A service that binds that user identities to an application instance running | |
|
ataly
2015/07/31 19:04:04
extra "that"
gauthamt
2015/07/31 20:24:16
Done.
| |
| 49 // in Mojo. | |
| 50 interface PrincipalService { | |
| 51 // Login is called by an application instance (requestor_url/qualifier) that | |
|
ataly
2015/07/31 19:04:04
Nit: We use "this" application instance in the com
gauthamt
2015/07/31 20:24:16
Changed it to "Removes the user blessing for the a
| |
| 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. | |
| 56 Login() => (Blessing? user_blessing); | |
| 57 | |
| 58 // Logout removes the user blessing for this application instance. | |
| 59 Logout(); | |
| 60 | |
| 61 // Sign returns a signature on the message using the private key that is | |
| 62 // persisted for this application instance. | |
| 63 Sign(array<uint8> message) => (Signature? signature); | |
| 64 | |
| 65 // GetUserBlessing returns the user blessing for a given application instance. | |
| 66 // It returns an error if the application instance has not invoked Login(). | |
| 67 GetUserBlessing(AppName app_name) => (Blessing? user_blessing); | |
| 68 }; | |
| 69 | |
| OLD | NEW |