git.frostfs.info/TrueCloudLab/frostfs-sdk-go@v0.0.0-20241022124111-5361f0ecebd3/crypto/doc.go (about)

     1  /*
     2  Package frostfscrypto collects FrostFS cryptographic primitives.
     3  
     4  Signer type unifies entities for signing FrostFS data.
     5  
     6  	// instantiate Signer
     7  	// select data to be signed
     8  
     9  	var sig Signature
    10  
    11  	err := sig.Calculate(signer, data)
    12  	// ...
    13  
    14  	// attach signature to the request
    15  
    16  SDK natively supports several signature schemes that are implemented
    17  in nested packages.
    18  
    19  PublicKey allows to verify signatures.
    20  
    21  	// get signature to be verified
    22  	// compose signed data
    23  
    24  	isValid := sig.Verify(data)
    25  	// ...
    26  
    27  Signature can be also used to process FrostFS API V2 protocol messages
    28  (see neo.fs.v2.refs package in https://git.frostfs.info/TrueCloudLab/frostfs-api).
    29  
    30  On client side:
    31  
    32  	import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
    33  
    34  	var msg refs.Signature
    35  	sig.WriteToV2(&msg)
    36  
    37  	// send msg
    38  
    39  On server side:
    40  
    41  	// recv msg
    42  
    43  	var sig frostfscrypto.Signature
    44  	sig.ReadFromV2(msg)
    45  
    46  	// process sig
    47  
    48  Using package types in an application is recommended to potentially work with
    49  different protocol versions with which these types are compatible.
    50  */
    51  package frostfscrypto