diff --git a/builtin.aqua b/builtin.aqua index 6345201..2a2a223 100644 --- a/builtin.aqua +++ b/builtin.aqua @@ -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. + -- 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