Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
74695ab9
Commit
74695ab9
authored
Dec 15, 2017
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: Documentation for Name/Key
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
7a786c55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
interface.go
interface.go
+47
-0
No files found.
interface.go
View file @
74695ab9
...
@@ -98,26 +98,73 @@ type DagAPI interface {
...
@@ -98,26 +98,73 @@ type DagAPI interface {
WithDepth
(
depth
int
)
options
.
DagTreeOption
WithDepth
(
depth
int
)
options
.
DagTreeOption
}
}
// NameAPI specifies the interface to IPNS.
//
// IPNS is a PKI namespace, where names are the hashes of public keys, and the
// private key enables publishing new (signed) values. In both publish and
// resolve, the default name used is the node's own PeerID, which is the hash of
// its public key.
//
// You can use .Key API to list and generate more names and their respective keys.
type
NameAPI
interface
{
type
NameAPI
interface
{
// Publish announces new IPNS name
Publish
(
ctx
context
.
Context
,
path
Path
,
opts
...
options
.
NamePublishOption
)
(
*
IpnsEntry
,
error
)
Publish
(
ctx
context
.
Context
,
path
Path
,
opts
...
options
.
NamePublishOption
)
(
*
IpnsEntry
,
error
)
// WithValidTime is an option for Publish which specifies for how long the
// entry will remain valid. Default value is 24h
WithValidTime
(
validTime
time
.
Duration
)
options
.
NamePublishOption
WithValidTime
(
validTime
time
.
Duration
)
options
.
NamePublishOption
// WithKey is an option for Publish which specifies the key to use for
// publishing. Default value is "self" which is the node's own PeerID.
//
// You can use .Key API to list and generate more names and their respective keys.
WithKey
(
key
string
)
options
.
NamePublishOption
WithKey
(
key
string
)
options
.
NamePublishOption
// Resolve attempts to resolve the newest version of the specified name
Resolve
(
ctx
context
.
Context
,
name
string
,
opts
...
options
.
NameResolveOption
)
(
Path
,
error
)
Resolve
(
ctx
context
.
Context
,
name
string
,
opts
...
options
.
NameResolveOption
)
(
Path
,
error
)
// WithRecursive is an option for Resolve which specifies whether to perform a
// recursive lookup. Default value is false
WithRecursive
(
recursive
bool
)
options
.
NameResolveOption
WithRecursive
(
recursive
bool
)
options
.
NameResolveOption
// WithLocal is an option for Resolve which specifies if the lookup should be
// offline. Default value is false
WithLocal
(
local
bool
)
options
.
NameResolveOption
WithLocal
(
local
bool
)
options
.
NameResolveOption
// WithNoCache is an option for Resolve which specifies when set to true
// disables the use of local name cache. Default value is false
WithNoCache
(
nocache
bool
)
options
.
NameResolveOption
WithNoCache
(
nocache
bool
)
options
.
NameResolveOption
}
}
// KeyAPI specifies the interface to Keystore
type
KeyAPI
interface
{
type
KeyAPI
interface
{
// Generate generates new key, stores it in the keystore under the specified
// name and returns a base58 encoded multihash of it's public key
Generate
(
ctx
context
.
Context
,
name
string
,
opts
...
options
.
KeyGenerateOption
)
(
string
,
error
)
Generate
(
ctx
context
.
Context
,
name
string
,
opts
...
options
.
KeyGenerateOption
)
(
string
,
error
)
// WithAlgorithm is an option for Generate which specifies which algorithm
// should be used for the key. Default is "rsa"
//
// Supported algorithms:
// * rsa
// * ed25519
WithAlgorithm
(
algorithm
string
)
options
.
KeyGenerateOption
WithAlgorithm
(
algorithm
string
)
options
.
KeyGenerateOption
// WithSize is an option for Generate which specifies the size of the key to
// generated. Default is 0
WithSize
(
size
int
)
options
.
KeyGenerateOption
WithSize
(
size
int
)
options
.
KeyGenerateOption
// Rename renames oldName key to newName.
Rename
(
ctx
context
.
Context
,
oldName
string
,
newName
string
,
opts
...
options
.
KeyRenameOption
)
(
string
,
bool
,
error
)
Rename
(
ctx
context
.
Context
,
oldName
string
,
newName
string
,
opts
...
options
.
KeyRenameOption
)
(
string
,
bool
,
error
)
// WithForce is an option for Rename which specifies whether to allow to
// replace existing keys.
WithForce
(
force
bool
)
options
.
KeyRenameOption
WithForce
(
force
bool
)
options
.
KeyRenameOption
// List lists keys stored in keystore
List
(
ctx
context
.
Context
)
(
map
[
string
]
string
,
error
)
//TODO: better key type?
List
(
ctx
context
.
Context
)
(
map
[
string
]
string
,
error
)
//TODO: better key type?
// Remove removes keys from keystore
Remove
(
ctx
context
.
Context
,
name
string
)
(
string
,
error
)
Remove
(
ctx
context
.
Context
,
name
string
)
(
string
,
error
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment