Skip to main content

client

import "github.com/bloock/bloock-sdk-go/v2/client"

Package client provides a client for interacting with the Bloock SDK.

Index​

AuthenticityClient​

type AuthenticityClient​

AuthenticityClient represents a client for interacting with the Bloock Authenticity service.

type AuthenticityClient struct {
// contains filtered or unexported fields
}
NewAuthenticityClient​

func NewAuthenticityClient​

func NewAuthenticityClient() AuthenticityClient

NewAuthenticityClient creates a new instance of the AuthenticityClient with default configuration.

NewAuthenticityClientWithConfig​

func NewAuthenticityClientWithConfig​

func NewAuthenticityClientWithConfig(configData *proto.ConfigData) AuthenticityClient

NewAuthenticityClientWithConfig creates a new instance of the AuthenticityClient with the provided configuration.

AuthenticityClient.GenerateEcdsaKeys​

func (*AuthenticityClient) GenerateEcdsaKeys​

func (c *AuthenticityClient) GenerateEcdsaKeys() (key.KeyPair, error)

GenerateEcdsaKeys generates ECDSA key pair for signing records. Deprecated: Will be deleted in future versions. Use KeyClient.newLocalKey function instead.

AuthenticityClient.GetSignatures​

func (*AuthenticityClient) GetSignatures​

func (c *AuthenticityClient) GetSignatures(r record.Record) ([]authenticity.Signature, error)

GetSignatures retrieves the signatures associated with a Bloock record.

AuthenticityClient.Sign​

func (*AuthenticityClient) Sign​

func (c *AuthenticityClient) Sign(r record.Record, s authenticity.Signer) (authenticity.Signature, error)

Sign signs a Bloock record using the specified signer.

AuthenticityClient.Verify​

func (*AuthenticityClient) Verify​

func (c *AuthenticityClient) Verify(r record.Record) (bool, error)

Verify verifies the authenticity of a Bloock record.

AvailabilityClient​

type AvailabilityClient​

AvailabilityClient represents a client for interacting with the Bloock Availability service.

type AvailabilityClient struct {
// contains filtered or unexported fields
}
NewAvailabilityClient​

func NewAvailabilityClient​

func NewAvailabilityClient() AvailabilityClient

NewAvailabilityClient creates a new instance of the AvailabilityClient with default configuration.

NewAvailabilityClientWithConfig​

func NewAvailabilityClientWithConfig​

func NewAvailabilityClientWithConfig(configData *proto.ConfigData) AvailabilityClient

NewAvailabilityClientWithConfig creates a new instance of the AvailabilityClient with the provided configuration.

AvailabilityClient.Publish​

func (*AvailabilityClient) Publish​

func (c *AvailabilityClient) Publish(r record.Record, publisher availability.Publisher) (string, error)

Publish publishes a Bloock record to the Availability service using the specified publisher.

AvailabilityClient.Retrieve​

func (*AvailabilityClient) Retrieve​

func (c *AvailabilityClient) Retrieve(loader availability.Loader) (record.Record, error)

Retrieve retrieves a Bloock record from the Availability service using the specified loader.

BloockClient​

type BloockClient​

BloockClient represents a client for interacting with the Bloock SDK.

type BloockClient struct {
AuthenticityClient AuthenticityClient
AvailabilityClient AvailabilityClient
EncryptionClient EncryptionClient
IdentityCoreClient IdentityCoreClient
IdentityClient IdentityClient
IntegrityClient IntegrityClient
KeyClient KeyClient
RecordClient RecordClient
WebhookClient WebhookClient
// contains filtered or unexported fields
}
NewBloockClient​

func NewBloockClient​

func NewBloockClient(apiKey string, identityApiHost *string) BloockClient

NewBloockClient creates a new instance of the Bloock SDK client with the specified configuration.

EncryptionClient​

type EncryptionClient​

EncryptionClient represents a client for interacting with the Bloock Encryption service.

type EncryptionClient struct {
// contains filtered or unexported fields
}
NewEncryptionClient​

func NewEncryptionClient​

func NewEncryptionClient() EncryptionClient

NewEncryptionClient creates a new instance of the EncryptionClient with default configuration.

NewEncryptionClientWithConfig​

func NewEncryptionClientWithConfig​

func NewEncryptionClientWithConfig(configData *proto.ConfigData) EncryptionClient

NewEncryptionClientWithConfig creates a new instance of the EncryptionClient with the provided configuration.

EncryptionClient.Decrypt​

func (*EncryptionClient) Decrypt​

func (c *EncryptionClient) Decrypt(r record.Record, decrypter encryption.Encrypter) (record.Record, error)

Decrypt decrypts a Bloock record using the specified decrypter.

EncryptionClient.Encrypt​

func (*EncryptionClient) Encrypt​

func (c *EncryptionClient) Encrypt(r record.Record, encrypter encryption.Encrypter) (record.Record, error)

Encrypt encrypts a Bloock record using the specified encrypter.

EncryptionClient.GenerateRsaKeyPair​

func (*EncryptionClient) GenerateRsaKeyPair​

func (c *EncryptionClient) GenerateRsaKeyPair() (key.KeyPair, error)

GenerateRsaKeyPair generates an RSA key pair for encryption. Deprecated: Will be deleted in future versions. Use KeyClient.newLocalKey function instead.

EncryptionClient.GetEncryptionAlg​

func (*EncryptionClient) GetEncryptionAlg​

func (c *EncryptionClient) GetEncryptionAlg(r record.Record) (encryption.EncryptionAlg, error)

GetEncryptionAlg retrieves the encryption algorithm used for a Bloock record.

IdentityClient​

type IdentityClient​

IdentityClient represents a client for interacting with the Bloock Identity service.

type IdentityClient struct {
// contains filtered or unexported fields
}
NewIdentityClient​

func NewIdentityClient​

func NewIdentityClient() IdentityClient

NewIdentityClient creates a new instance of the IdentityClient with default configuration.

NewIdentityClientWithConfig​

func NewIdentityClientWithConfig​

func NewIdentityClientWithConfig(configData *proto.ConfigData) IdentityClient

NewIdentityClientWithConfig creates a new instance of the IdentityClient with the provided configuration.

IdentityClient.BuildCredential​

func (*IdentityClient) BuildCredential​

func (c *IdentityClient) BuildCredential(issuer identity.Issuer, schemaId, holderDid string, expiration int64, version int32) identity.CredentialBuilder

BuildCredential creates a new credential builder for defining a credential on the Bloock Identity service.

IdentityClient.BuildSchema​

func (*IdentityClient) BuildSchema​

func (c *IdentityClient) BuildSchema(displayName string, schemaType, version, description string) identity.SchemaBuilder

BuildSchema creates a new schema builder for defining a schema on the Bloock Identity service.

IdentityClient.CreateHolder​

func (*IdentityClient) CreateHolder​

func (c *IdentityClient) CreateHolder(holderKey key.Key, didMethod identity.DidMethod) (identity.Holder, error)

CreateHolder creates a new holder identity.

IdentityClient.CreateIssuer​

func (*IdentityClient) CreateIssuer​

func (c *IdentityClient) CreateIssuer(issuerKey key.Key, publishInterval identity.PublishIntervalParams, didMethod identity.DidMethod, name, description, image string) (identity.Issuer, error)

CreateIssuer creates a new issuer identity on the Bloock Identity service.

IdentityClient.CreateVerification​

func (*IdentityClient) CreateVerification​

func (c *IdentityClient) CreateVerification(proofRequest string) (identity.VerificationReceipt, error)

CreateVerification creates a new verification session on the identity managed API provided.

IdentityClient.ForcePublishIssuerState​

func (*IdentityClient) ForcePublishIssuerState​

func (c *IdentityClient) ForcePublishIssuerState(issuer identity.Issuer) (identity.IssuerStateReceipt, error)

ForcePublishIssuerState publishes the state of an issuer on the Bloock Identity service.

IdentityClient.GetCredential​

func (*IdentityClient) GetCredential​

func (c *IdentityClient) GetCredential(credentialId string) (identity.Credential, error)

GetCredential retrieves the Verifiable Credential entity based on the credential ID (UUID). (ex: 1bf0c79e-55e6-4f14-aa9d-fb55619ba0cf)

IdentityClient.GetCredentialOffer​

func (*IdentityClient) GetCredentialOffer​

func (c *IdentityClient) GetCredentialOffer(issuer identity.Issuer, credentialId string) (string, error)

GetCredentialOffer retrieves the json raw offer based on the credential ID (UUID). (ex: 1bf0c79e-55e6-4f14-aa9d-fb55619ba0cf)

IdentityClient.GetCredentialProof​

func (*IdentityClient) GetCredentialProof​

func (c *IdentityClient) GetCredentialProof(issuerDid string, credentialId string) (identity.CredentialProof, error)

GetCredentialProof retrieves the proof of a credential on the Bloock Identity service.

IdentityClient.GetSchema​

func (*IdentityClient) GetSchema​

func (c *IdentityClient) GetSchema(id string) (identity.Schema, error)

GetSchema retrieves a schema from the Bloock Identity service based on the schema ID (ex: Qma1t4uzbnB93E4rasNdu5UWMDh5qg3wMkPm68cnEyfnoM).

IdentityClient.GetVerificationStatus​

func (*IdentityClient) GetVerificationStatus​

func (c *IdentityClient) GetVerificationStatus(sessionID int64) (bool, error)

GetVerificationStatus retrieves the status of a verification session on the identity managed API provided.

IdentityClient.ImportIssuer​

func (*IdentityClient) ImportIssuer​

func (c *IdentityClient) ImportIssuer(issuerKey key.Key, didMethod identity.DidMethod) (identity.Issuer, error)

ImportIssuer retrieves the issuer based on the issuer key and DID method.

IdentityClient.RevokeCredential​

func (*IdentityClient) RevokeCredential​

func (c *IdentityClient) RevokeCredential(credential identity.Credential, issuer identity.Issuer) (bool, error)

RevokeCredential revokes a credential on the Bloock Identity service.

IdentityClient.WaitVerification​

func (*IdentityClient) WaitVerification​

func (c *IdentityClient) WaitVerification(sessionID int64, params identity.VerificationParams) (bool, error)

WaitVerification waits for the completion of a verification session on the identity managed API provided.

IdentityCoreClient​

type IdentityCoreClient​

IdentityCoreClient represents a client for interacting with the Bloock Identity service.

type IdentityCoreClient struct {
// contains filtered or unexported fields
}
NewIdentityCoreClient​

func NewIdentityCoreClient​

func NewIdentityCoreClient() IdentityCoreClient

NewIdentityCoreClient creates a new instance of the IdentityCoreClient with default configuration.

NewIdentityCoreClientWithConfig​

func NewIdentityCoreClientWithConfig​

func NewIdentityCoreClientWithConfig(configData *proto.ConfigData) IdentityCoreClient

NewIdentityCoreClientWithConfig creates a new instance of the IdentityCoreClient with the provided configuration.

IdentityCoreClient.BuildCredential​

func (*IdentityCoreClient) BuildCredential​

func (c *IdentityCoreClient) BuildCredential(issuer identity.Issuer, schemaId, holderDid string, expiration int64, version int32) identity.CredentialCoreBuilder

BuildCredential creates a new credential builder for defining a credential on the Bloock Identity service.

IntegrityClient​

type IntegrityClient​

IntegrityClient provides functionality to interact with the Bloock Integrity service.

type IntegrityClient struct {
// contains filtered or unexported fields
}
NewIntegrityClient​

func NewIntegrityClient​

func NewIntegrityClient() IntegrityClient

NewIntegrityClient creates a new IntegrityClient with default configuration.

NewIntegrityClientWithConfig​

func NewIntegrityClientWithConfig​

func NewIntegrityClientWithConfig(configData *proto.ConfigData) IntegrityClient

NewIntegrityClientWithConfig creates a new IntegrityClient with the given configuration.

IntegrityClient.GetAnchor​

func (*IntegrityClient) GetAnchor​

func (c *IntegrityClient) GetAnchor(anchorID int64) (integrity.Anchor, error)

GetAnchor retrieves an anchor by its ID from the Bloock Integrity service.

IntegrityClient.GetProof​

func (*IntegrityClient) GetProof​

func (c *IntegrityClient) GetProof(records []record.Record) (integrity.Proof, error)

GetProof retrieves a proof for a set of records from the Bloock Integrity service.

IntegrityClient.SendRecords​

func (*IntegrityClient) SendRecords​

func (c *IntegrityClient) SendRecords(records []record.Record) ([]integrity.RecordReceipt, error)

SendRecords sends records to the Bloock Integrity service for certification.

IntegrityClient.ValidateRoot​

func (*IntegrityClient) ValidateRoot​

func (c *IntegrityClient) ValidateRoot(root string, params integrity.NetworkParams) (uint64, error)

ValidateRoot validates the integrity of a merkle root proof on blockchain.

IntegrityClient.VerifyProof​

func (*IntegrityClient) VerifyProof​

func (c *IntegrityClient) VerifyProof(proof integrity.Proof) (string, error)

VerifyProof verifies the integrity of a proof.

IntegrityClient.VerifyRecords​

func (*IntegrityClient) VerifyRecords​

func (c *IntegrityClient) VerifyRecords(records []record.Record, params integrity.NetworkParams) (uint64, error)

VerifyRecords verifies the integrity of a set of records.

IntegrityClient.WaitAnchor​

func (*IntegrityClient) WaitAnchor​

func (c *IntegrityClient) WaitAnchor(anchorID int64, params integrity.AnchorParams) (integrity.Anchor, error)

WaitAnchor waits for the completion of an anchor on the Bloock Integrity service.

KeyClient​

type KeyClient​

KeyClient provides functionality to interact with the Bloock Key service.

type KeyClient struct {
// contains filtered or unexported fields
}
NewKeyClient​

func NewKeyClient​

func NewKeyClient() KeyClient

NewKeyClient creates a new KeyClient with default configuration.

NewKeyClientWithConfig​

func NewKeyClientWithConfig​

func NewKeyClientWithConfig(configData *proto.ConfigData) KeyClient

NewKeyClientWithConfig creates a new KeyClient with the given configuration.

KeyClient.ImportManagedCertificate​

func (*KeyClient) ImportManagedCertificate​

func (c *KeyClient) ImportManagedCertificate(_type keyEntity.CertificateType, certificate []byte, params keyEntity.ImportCertificateParams) (keyEntity.ManagedCertificate, error)

ImportManagedCertificate imports a managed certificate with the specified parameters.

Supported types: .pem, .pfx.

KeyClient.LoadLocalCertificate​

func (*KeyClient) LoadLocalCertificate​

func (c *KeyClient) LoadLocalCertificate(pkcs12 []byte, password string) (keyEntity.LocalCertificate, error)

LoadLocalCertificate loads a local certificate from a PKCS12 file.

KeyClient.LoadLocalKey​

func (*KeyClient) LoadLocalKey​

func (c *KeyClient) LoadLocalKey(keyType keyEntity.KeyType, key string) (keyEntity.LocalKey, error)

LoadLocalKey loads a local key of the specified type from a public key string.

KeyClient.LoadManagedCertificate​

func (*KeyClient) LoadManagedCertificate​

func (c *KeyClient) LoadManagedCertificate(id string) (keyEntity.ManagedCertificate, error)

LoadManagedCertificate loads a managed certificate by its ID (ex: ceef5b02-af17-43d8-ae7b-31d9bdf8027f).

KeyClient.LoadManagedKey​

func (*KeyClient) LoadManagedKey​

func (c *KeyClient) LoadManagedKey(id string) (keyEntity.ManagedKey, error)

LoadManagedKey loads a managed key by its ID (ex: 51d22546-68f1-4340-b94b-2a80e60b8933).

KeyClient.NewLocalCertificate​

func (*KeyClient) NewLocalCertificate​

func (c *KeyClient) NewLocalCertificate(params keyEntity.LocalCertificateParams) (keyEntity.LocalCertificate, error)

NewLocalCertificate generates a new local certificate with the specified parameters.

KeyClient.NewLocalKey​

func (*KeyClient) NewLocalKey​

func (c *KeyClient) NewLocalKey(keyType keyEntity.KeyType) (keyEntity.LocalKey, error)

NewLocalKey generates a new local key of the specified type.

KeyClient.NewManagedCertificate​

func (*KeyClient) NewManagedCertificate​

func (c *KeyClient) NewManagedCertificate(params keyEntity.ManagedCertificateParams) (keyEntity.ManagedCertificate, error)

NewManagedCertificate generates a new managed certificate with the specified parameters.

KeyClient.NewManagedKey​

func (*KeyClient) NewManagedKey​

func (c *KeyClient) NewManagedKey(params keyEntity.ManagedKeyParams) (keyEntity.ManagedKey, error)

NewManagedKey generates a new managed key with the specified parameters.

KeyClient.RecoverTotpAccessControl​

func (*KeyClient) RecoverTotpAccessControl​

func (c *KeyClient) RecoverTotpAccessControl(key keyEntity.Managed, code string) (keyEntity.TotpAccessControlReceipt, error)

RecoverTotpAccessControl recovers TOTP-based access control for the given managed key or managed certificate using a recovery code.

KeyClient.SetupSecretAccessControl​

func (*KeyClient) SetupSecretAccessControl​

func (c *KeyClient) SetupSecretAccessControl(key keyEntity.Managed, secret string, email string) error

SetupSecretAccessControl sets up secret-based access control for the given managed key or managed certificate.

KeyClient.SetupTotpAccessControl​

func (*KeyClient) SetupTotpAccessControl​

func (c *KeyClient) SetupTotpAccessControl(key keyEntity.Managed) (keyEntity.TotpAccessControlReceipt, error)

SetupTotpAccessControl sets up TOTP-based access control for the given managed key or managed certificate.

RecordBuilder​

type RecordBuilder​

RecordBuilder assists in constructing records with various configurations.

type RecordBuilder struct {
// contains filtered or unexported fields
}
RecordBuilder.Build​

func (RecordBuilder) Build​

func (b RecordBuilder) Build() (record.Record, error)

Build constructs a record based on the RecordBuilder's configuration.

RecordBuilder.GetDetails​

func (RecordBuilder) GetDetails​

func (b RecordBuilder) GetDetails() (record.RecordDetails, error)

GetDetails retrieves details about other Bloock services (Integrity, Authenticity, Encryption, Availability) configured in the RecordBuilder.

RecordBuilder.WithDecrypter​

func (RecordBuilder) WithDecrypter​

func (b RecordBuilder) WithDecrypter(decrypter encryption.Encrypter) RecordBuilder

WithDecrypter sets the decrypter for the RecordBuilder.

RecordBuilder.WithEncrypter​

func (RecordBuilder) WithEncrypter​

func (b RecordBuilder) WithEncrypter(encrypter encryption.Encrypter) RecordBuilder

WithEncrypter sets the encrypter for the RecordBuilder.

RecordBuilder.WithSigner​

func (RecordBuilder) WithSigner​

func (b RecordBuilder) WithSigner(signer authenticity.Signer) RecordBuilder

WithSigner sets the signer for the RecordBuilder.

RecordClient​

type RecordClient​

RecordClient provides functionality for creating records using various data sources and to interact with the Bloock Record service.

type RecordClient struct {
// contains filtered or unexported fields
}
NewRecordClient​

func NewRecordClient​

func NewRecordClient() RecordClient

NewRecordClient creates a new RecordClient with default configuration.

NewRecordClientWithConfig​

func NewRecordClientWithConfig​

func NewRecordClientWithConfig(configData *proto.ConfigData) RecordClient

NewRecordClientWithConfig creates a new RecordClient with the provided configuration.

RecordClient.FromBytes​

func (RecordClient) FromBytes​

func (c RecordClient) FromBytes(bytes []byte) RecordBuilder

FromBytes creates a RecordBuilder from a byte slice payload.

RecordClient.FromFile​

func (RecordClient) FromFile​

func (c RecordClient) FromFile(file_bytes []byte) RecordBuilder

FromFile creates a RecordBuilder from a byte slice representing a file.

RecordClient.FromHex​

func (RecordClient) FromHex​

func (c RecordClient) FromHex(hex string) RecordBuilder

FromHex creates a RecordBuilder from a hexadecimal string payload.

RecordClient.FromJSON​

func (RecordClient) FromJSON​

func (c RecordClient) FromJSON(json string) RecordBuilder

FromJSON creates a RecordBuilder from a JSON string payload.

RecordClient.FromLoader​

func (RecordClient) FromLoader​

func (c RecordClient) FromLoader(loader availability.Loader) RecordBuilder

FromLoader creates a RecordBuilder from a data loader.

RecordClient.FromRecord​

func (RecordClient) FromRecord​

func (c RecordClient) FromRecord(record record.Record) RecordBuilder

FromRecord creates a RecordBuilder from an existing record.

RecordClient.FromString​

func (RecordClient) FromString​

func (c RecordClient) FromString(str string) RecordBuilder

FromString creates a RecordBuilder from a string payload.

WebhookClient​

type WebhookClient​

WebhookClient provides functionality for interacting with Bloock webhooks.

type WebhookClient struct {
// contains filtered or unexported fields
}
NewWebhookClient​

func NewWebhookClient​

func NewWebhookClient() WebhookClient

NewWebhookClient creates a new WebhookClient with default configuration.

NewWebhookClientWithConfig​

func NewWebhookClientWithConfig​

func NewWebhookClientWithConfig(configData *proto.ConfigData) WebhookClient

NewWebhookClientWithConfig creates a new WebhookClient with the provided configuration.

WebhookClient.VerifyWebhookSignature​

func (*WebhookClient) VerifyWebhookSignature​

func (c *WebhookClient) VerifyWebhookSignature(payload []byte, header string, secretKey string, enforceTolerance bool) (bool, error)

VerifyWebhookSignature verifies the signature of a webhook payload using the provided parameters.

Generated by gomarkdoc