Skip to main content

PublicKey

type PublicKey​

Enum of valid public keys for the signature schemes supported by IOTA.

BCS​

The BCS serialized form of this type is specified in [`bcs-schema.abnf`](https://github.com/iotaledger/iota-rust-sdk/blob/develop/crates/iota-sdk-types/bcs-schema.abnf\).

The gap in the flag values of the `public-key` rule is intentional, as not all signature schemes support public keys.

There is also a base64 encoding for this type defined as:

```text base64-public-key = string ; which is valid base64 encoded ; and the decoded bytes are defined ; by flagged-public-key flagged-public-key = (ed25519-flag ed25519-public-key) / (secp256k1-flag secp256k1-public-key) / (secp256r1-flag secp256r1-public-key) / (passkey-flag passkey-public-key) ```

type PublicKey struct {
// contains filtered or unexported fields
}

func LiftFromExternalPublicKey​

func LiftFromExternalPublicKey(handle uint64) *PublicKey

func PublicKeyFromBase64​

func PublicKeyFromBase64(s string) (*PublicKey, error)

Decode a public key from a base64 string of its scheme-flagged byte representation

func PublicKeyFromBcs​

func PublicKeyFromBcs(bcs []byte) (*PublicKey, error)

Create this type from BCS encoded bytes.

func PublicKeyFromJson​

func PublicKeyFromJson(json string) (*PublicKey, error)

Create this type from a JSON encoded string.

func (*PublicKey) AsEd25519​

func (_self *PublicKey) AsEd25519() *Ed25519PublicKey

func (*PublicKey) AsOptEd25519​

func (_self *PublicKey) AsOptEd25519() **Ed25519PublicKey

func (*PublicKey) AsOptPasskey​

func (_self *PublicKey) AsOptPasskey() **PasskeyPublicKey

func (*PublicKey) AsOptSecp256k1​

func (_self *PublicKey) AsOptSecp256k1() **Secp256k1PublicKey

func (*PublicKey) AsOptSecp256r1​

func (_self *PublicKey) AsOptSecp256r1() **Secp256r1PublicKey

func (*PublicKey) AsPasskey​

func (_self *PublicKey) AsPasskey() *PasskeyPublicKey

func (*PublicKey) AsSecp256k1​

func (_self *PublicKey) AsSecp256k1() *Secp256k1PublicKey

func (*PublicKey) AsSecp256r1​

func (_self *PublicKey) AsSecp256r1() *Secp256r1PublicKey

func (*PublicKey) DebugString​

func (_self *PublicKey) DebugString() string

func (*PublicKey) Destroy​

func (object *PublicKey) Destroy()

func (*PublicKey) Eq​

func (_self *PublicKey) Eq(other *PublicKey) bool

func (*PublicKey) IsEd25519​

func (_self *PublicKey) IsEd25519() bool

func (*PublicKey) IsPasskey​

func (_self *PublicKey) IsPasskey() bool

func (*PublicKey) IsSecp256k1​

func (_self *PublicKey) IsSecp256k1() bool

func (*PublicKey) IsSecp256r1​

func (_self *PublicKey) IsSecp256r1() bool

func (*PublicKey) Ne​

func (_self *PublicKey) Ne(other *PublicKey) bool

func (*PublicKey) Scheme​

func (_self *PublicKey) Scheme() SignatureScheme

func (*PublicKey) ToBase64​

func (_self *PublicKey) ToBase64() string

Encode this public key as a base64 string of its scheme-flagged byte representation

func (*PublicKey) ToBcs​

func (_self *PublicKey) ToBcs() ([]byte, error)

Convert this type to BCS encoded bytes.

func (*PublicKey) ToDisplayString​

func (_self *PublicKey) ToDisplayString() string

Render this type as human-readable text.

Some types also print this through the binding's native string conversion; this method is the spelling every object type has.

The layout is meant for reading and can change between releases. Use the JSON or BCS conversions for output that gets parsed.

func (*PublicKey) ToJson​

func (_self *PublicKey) ToJson() (string, error)

Convert this type to a JSON encoded string.