Profile
This module holds objects and functions to load a nanopub user profile.
Profile
Represents a user profile.
Attributes:
Name | Type | Description |
---|---|---|
orcid_id |
str
|
The user’s ORCID |
name |
str
|
The user’s name |
private_key |
Optional[Union[Path, str]]
|
Path to the user’s private key, or the key as string |
public_key |
Optional[Union[Path, str]]
|
Path to the user’s public key, or the key as string |
introduction_nanopub_uri |
Optional[str]
|
URI of the user’s profile nanopub |
Source code in nanopub/profile.py
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 |
|
__init__(orcid_id, name, private_key=None, public_key=None, introduction_nanopub_uri=None)
Create a Profile.
Source code in nanopub/profile.py
generate_keys()
Generate private/public RSA key pair at the path specified in the profile.yml, to be used to sign nanopubs
Source code in nanopub/profile.py
store(folder=USER_CONFIG_DIR)
Stores the nanopub user profile. By default the profile is stored in HOME_DIR/.nanopub/profile.yaml
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder |
Path
|
The path to the folder to store the user’s profile files. |
USER_CONFIG_DIR
|
Returns:
Type | Description |
---|---|
str
|
The path where the profile was stored. |
Source code in nanopub/profile.py
ProfileError
ProfileLoader
Bases: Profile
A class to load a user profile from a local YAML file, only used for YAtiML.
Source code in nanopub/profile.py
__init__(orcid_id, name, private_key, public_key, introduction_nanopub_uri=None)
Create a ProfileLoader.
Source code in nanopub/profile.py
format_key(key)
Format private and public keys to remove header/footer and all newlines, as this is required by nanopub-java
Source code in nanopub/profile.py
generate_keyfiles(path=USER_CONFIG_DIR)
Generate private/public RSA key pair at the path specified in the profile.yml, to be used to sign nanopubs
Source code in nanopub/profile.py
load_profile(profile_path=DEFAULT_PROFILE_PATH)
Retrieve nanopub user profile.
By default the profile is stored in HOME_DIR/.nanopub/profile.yaml
.
Returns:
Type | Description |
---|---|
Profile
|
A Profile containing the data from the configuration file. |
Raises:
Type | Description |
---|---|
RecognitionError
|
If there is an error in the file. |