@@ -65,26 +65,73 @@ type UnixfsAPI interface {
65
65
Ls (context.Context , Path ) ([]* Link , error )
66
66
}
67
67
68
+ // NameAPI specifies the interface to IPNS.
69
+ //
70
+ // IPNS is a PKI namespace, where names are the hashes of public keys, and the
71
+ // private key enables publishing new (signed) values. In both publish and
72
+ // resolve, the default name used is the node's own PeerID, which is the hash of
73
+ // its public key.
74
+ //
75
+ // You can use .Key API to list and generate more names and their respective keys.
68
76
type NameAPI interface {
77
+ // Publish announces new IPNS name
69
78
Publish (ctx context.Context , path Path , opts ... options.NamePublishOption ) (* IpnsEntry , error )
79
+
80
+ // WithValidTime is an option for Publish which specifies for how long the
81
+ // entry will remain valid. Default value is 24h
70
82
WithValidTime (validTime time.Duration ) options.NamePublishOption
83
+
84
+ // WithKey is an option for Publish which specifies the key to use for
85
+ // publishing. Default value is "self" which is the node's own PeerID.
86
+ //
87
+ // You can use .Key API to list and generate more names and their respective keys.
71
88
WithKey (key string ) options.NamePublishOption
72
89
90
+ // Resolve attempts to resolve the newest version of the specified name
73
91
Resolve (ctx context.Context , name string , opts ... options.NameResolveOption ) (Path , error )
92
+
93
+ // WithRecursive is an option for Resolve which specifies whether to perform a
94
+ // recursive lookup. Default value is false
74
95
WithRecursive (recursive bool ) options.NameResolveOption
96
+
97
+ // WithLocal is an option for Resolve which specifies if the lookup should be
98
+ // offline. Default value is false
75
99
WithLocal (local bool ) options.NameResolveOption
100
+
101
+ // WithNoCache is an option for Resolve which specifies when set to true
102
+ // disables the use of local name cache. Default value is false
76
103
WithNoCache (nocache bool ) options.NameResolveOption
77
104
}
78
105
106
+ // KeyAPI specifies the interface to Keystore
79
107
type KeyAPI interface {
108
+ // Generate generates new key, stores it in the keystore under the specified
109
+ // name and returns a base58 encoded multihash of it's public key
80
110
Generate (ctx context.Context , name string , opts ... options.KeyGenerateOption ) (string , error )
111
+
112
+ // WithAlgorithm is an option for Generate which specifies which algorithm
113
+ // should be used for the key. Default is "rsa"
114
+ //
115
+ // Supported algorithms:
116
+ // * rsa
117
+ // * ed25519
81
118
WithAlgorithm (algorithm string ) options.KeyGenerateOption
119
+
120
+ // WithSize is an option for Generate which specifies the size of the key to
121
+ // generated. Default is 0
82
122
WithSize (size int ) options.KeyGenerateOption
83
123
124
+ // Rename renames oldName key to newName.
84
125
Rename (ctx context.Context , oldName string , newName string , opts ... options.KeyRenameOption ) (string , bool , error )
126
+
127
+ // WithForce is an option for Rename which specifies whether to allow to
128
+ // replace existing keys.
85
129
WithForce (force bool ) options.KeyRenameOption
86
130
131
+ // List lists keys stored in keystore
87
132
List (ctx context.Context ) (map [string ]string , error ) //TODO: better key type?
133
+
134
+ // Remove removes keys from keystore
88
135
Remove (ctx context.Context , name string ) (string , error )
89
136
}
90
137
0 commit comments