Documentation ¶
Index ¶
- Constants
- Variables
- func LongTo8ByteArray(long int) (out []byte)
- func ShortTo2ByteArray(long int) []byte
- type ArweaveSigner
- func (self *ArweaveSigner) GetOwner() []byte
- func (self *ArweaveSigner) GetOwnerLength() int
- func (self *ArweaveSigner) GetSignatureLength() int
- func (self *ArweaveSigner) GetType() SignatureType
- func (self *ArweaveSigner) Sign(data []byte) (signature []byte, err error)
- func (self *ArweaveSigner) Verify(data []byte, signature []byte) (err error)
- type BaseClient
- type BundleItem
- func (self *BundleItem) Encode(out *bytes.Buffer) (err error)
- func (self *BundleItem) IsSigned() bool
- func (self *BundleItem) MarshalTo(buf []byte) (n int, err error)
- func (self *BundleItem) Reader() (out *bytes.Buffer, err error)
- func (self *BundleItem) Sign(signer Signer) (err error)
- func (self *BundleItem) Size() (out int)
- func (self *BundleItem) Unmarshal(buf []byte) (err error)
- func (self *BundleItem) UnmarshalFromReader(reader io.Reader) (err error)
- func (self *BundleItem) Verify() (err error)
- func (self *BundleItem) VerifySignature() (err error)
- type Client
- type EtherumSigner
- func (self *EtherumSigner) GetOwner() []byte
- func (self *EtherumSigner) GetOwnerLength() int
- func (self *EtherumSigner) GetSignatureLength() int
- func (self *EtherumSigner) GetType() SignatureType
- func (self *EtherumSigner) Sign(data []byte) (signature []byte, err error)
- func (self *EtherumSigner) Verify(data []byte, signature []byte) (err error)
- type SignatureType
- type Signer
- type Tag
- type Tags
Constants ¶
View Source
const ( // Setting this flag disables retrying request with peers ContextDisablePeers = value("disablePeers") // Forces the URL of the peer, otherwise the default one is picked ContextForcePeer = value("forcePeer") )
Variables ¶
View Source
var ( ErrSignerNotSpecified = errors.New("signer not specified") ErrUnmarshalEtherumPubKey = errors.New("cannot unmarshal etherum pubkey") ErrEtherumSignatureMismatch = errors.New("etherum signature mismatch") ErrFailedToParse = errors.New("failed to parse response") ErrIdEmpty = errors.New("bundle id is empty") ErrNotEnoughBytesForSignatureType = errors.New("not enough bytes for the signature type") ErrNotEnoughBytesForSignature = errors.New("not enough bytes for the signature") ErrNotEnoughBytesForOwner = errors.New("not enough bytes for the owner") ErrNotEnoughBytesForTargetFlag = errors.New("not enough bytes for the target flag") ErrNotEnoughBytesForTarget = errors.New("not enough bytes for the target") ErrNotEnoughBytesForAnchorFlag = errors.New("not enough bytes for the anchor flag") ErrNotEnoughBytesForAnchor = errors.New("not enough bytes for the anchor") ErrNotEnoughBytesForNumberOfTags = errors.New("not enough bytes for the number of tags") ErrNotEnoughBytesForNumberOfTagBytes = errors.New("not enough bytes for the number of tag bytes") ErrNotEnoughBytesForTags = errors.New("not enough bytes for tags") ErrVerifyIdSignatureMismatch = errors.New("id doesn't match signature") ErrVerifyBadAnchorLength = errors.New("anchor must be 32 bytes long") ErrVerifyTooManyTags = errors.New("too many tags, max is 128") ErrVerifyEmptyTagName = errors.New("tag name is empty") ErrVerifyTooLongTagName = errors.New("tag name is too long, max is 1024 bytes") ErrVerifyEmptyTagValue = errors.New("tag value is empty") ErrVerifyTooLongTagValue = errors.New("tag value is too long, max is 3072 bytes") ErrVerifyTooManyTagsBytes = errors.New("serialized tags are too long, max is 4KB") ErrBufferTooSmall = errors.New("buffer too small") ErrUnsupportedSignatureType = errors.New("unsupported signature type") ErrFailedToParseEtherumPublicKey = errors.New("failed to parse etherum public key") ErrNotSigned = errors.New("bundle item not signed") )
Functions ¶
func LongTo8ByteArray ¶
func ShortTo2ByteArray ¶
Types ¶
type ArweaveSigner ¶ added in v0.1.209
type ArweaveSigner struct { PrivateKey *rsa.PrivateKey Owner []byte }
func NewArweaveSigner ¶ added in v0.1.209
func NewArweaveSigner(privateKeyJWK string) (self *ArweaveSigner, err error)
func (*ArweaveSigner) GetOwner ¶ added in v0.1.209
func (self *ArweaveSigner) GetOwner() []byte
func (*ArweaveSigner) GetOwnerLength ¶ added in v0.1.209
func (self *ArweaveSigner) GetOwnerLength() int
func (*ArweaveSigner) GetSignatureLength ¶ added in v0.1.209
func (self *ArweaveSigner) GetSignatureLength() int
func (*ArweaveSigner) GetType ¶ added in v0.1.209
func (self *ArweaveSigner) GetType() SignatureType
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
func (*BaseClient) Request ¶
func (self *BaseClient) Request(ctx context.Context) (*resty.Request, context.CancelFunc)
func (*BaseClient) Reset ¶
func (self *BaseClient) Reset()
func (*BaseClient) SetPeers ¶
func (self *BaseClient) SetPeers(peers []string)
Set the list of potential peers in order they should be used Uses only peers that are proper urls
type BundleItem ¶
type BundleItem struct { SignatureType SignatureType `json:"signature_type"` Signature arweave.Base64String `json:"signature"` Owner arweave.Base64String `json:"owner"` // utils.Base64Encode(pubkey) Target arweave.Base64String `json:"target"` // optional, if exist must length 32, and is base64 str Anchor arweave.Base64String `json:"anchor"` // optional, if exist must length 32, and is base64 str Tags Tags `json:"tags"` Data arweave.Base64String `json:"data"` Id arweave.Base64String `json:"id"` // contains filtered or unexported fields }
func (*BundleItem) Encode ¶ added in v0.1.205
func (self *BundleItem) Encode(out *bytes.Buffer) (err error)
func (*BundleItem) IsSigned ¶ added in v0.1.211
func (self *BundleItem) IsSigned() bool
func (*BundleItem) MarshalTo ¶ added in v0.1.205
func (self *BundleItem) MarshalTo(buf []byte) (n int, err error)
func (*BundleItem) Sign ¶ added in v0.1.211
func (self *BundleItem) Sign(signer Signer) (err error)
func (*BundleItem) Size ¶ added in v0.1.205
func (self *BundleItem) Size() (out int)
func (*BundleItem) Unmarshal ¶ added in v0.1.201
func (self *BundleItem) Unmarshal(buf []byte) (err error)
func (*BundleItem) UnmarshalFromReader ¶ added in v0.1.205
func (self *BundleItem) UnmarshalFromReader(reader io.Reader) (err error)
Reverse operation of Reader
func (*BundleItem) Verify ¶ added in v0.1.202
func (self *BundleItem) Verify() (err error)
https://github.com/ArweaveTeam/arweave-standards/blob/master/ans/ANS-104.md#21-verifying-a-dataitem
func (*BundleItem) VerifySignature ¶ added in v0.1.202
func (self *BundleItem) VerifySignature() (err error)
type EtherumSigner ¶ added in v0.1.209
type EtherumSigner struct { PrivateKey *ecdsa.PrivateKey Owner []byte }
func NewEtherumSigner ¶ added in v0.1.209
func NewEtherumSigner(privateKeyHex string) (self *EtherumSigner, err error)
func (*EtherumSigner) GetOwner ¶ added in v0.1.209
func (self *EtherumSigner) GetOwner() []byte
func (*EtherumSigner) GetOwnerLength ¶ added in v0.1.209
func (self *EtherumSigner) GetOwnerLength() int
func (*EtherumSigner) GetSignatureLength ¶ added in v0.1.209
func (self *EtherumSigner) GetSignatureLength() int
func (*EtherumSigner) GetType ¶ added in v0.1.209
func (self *EtherumSigner) GetType() SignatureType
type SignatureType ¶ added in v0.1.209
type SignatureType int
const ( SignatureTypeArweave SignatureType = 1 SignatureTypeEtherum SignatureType = 3 )
Values are taken from bundlr library https://github.com/Bundlr-Network/arbundles/blob/5413fe576098355f7502a5fa9456f8db6a861492/src/constants.ts#L4
func (SignatureType) Bytes ¶ added in v0.1.209
func (self SignatureType) Bytes() []byte
type Signer ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.