Sig service redesign (#20)

This commit is contained in:
Pavel 2022-02-04 21:18:03 +03:00 committed by GitHub
parent 04e5d1775c
commit 83efd3dd74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,17 +254,32 @@ service Script("script"):
-- Each object in the list is of the following structure
list() -> []ScriptInfo
data SignResult:
-- Was call successful or not
success: bool
-- Error message. Will be null if the call is successful
error: ?string
-- Signature as byte array. Will be null if the call is not successful
signature: ?[]u8
-- Available only on FluenceJS peers
-- The service can also be resolved by it's host peer id
service Sig("sig"):
-- Signs data with the current peer's key.
-- Can only be called on %init_peer_id%
-- Accepts data only from the following sources:
-- Signs data with the service's private key.
-- Depending on implementation the service might check call params to restrict usage for security reasons.
-- By default it is only allowed to be used on the same peer the particle was initiated
-- and accepts data only from the following sources:
-- trust-graph.get_trust_bytes
-- trust-graph.get_revocation_bytes
-- registry.get_key_bytes
-- registry.get_record_bytes
-- registry.get_host_record_bytes
-- Argument: data - byte array to sign
-- Returns: signature as a byte array
sign(data: []u8) -> []u8
-- Returns: signature as SignResult structure
sign(data: []u8) -> SignResult
-- Given the data and signature both as byte arrays, returns true if the signature is correct, false otherwise.
verify(signature: []u8, data: []u8) -> bool
-- Gets service's public key.
get_pub_key() -> string