Skip to main content

%Wallet.Secret

abstract persistent class %Wallet.Secret extends %SYS.Wallet.Secret

SQL Table Name: %Wallet.Secret

This is the base class for all wallet secret implementations. Each secret defines a storage mechanism, given by the Storage property, which must be a subclass of %Wallet.Storage. The default storage mechanism is %Wallet.LocalStorage. Secrets must exist in a %Wallet.Collection. Access to the secret is governed by the resource defined by the collection. The collection name is specified as part of the secret name: .. Secrets are managed using the Create(), Update() and Delete() methods. The properties parameter for Create() and Modify() can be either a subscripted array of property values, or a dynamic object.
  // create a collection:
  set status = ##class(%Wallet.Collection).Create(
  	"ExampleCollection", {
  		"Resource": "MyCustomResource"
  })
  	
  // create a secret named "MySecret" containing the given user & password:
  set status = ##class(%Wallet.KeyValue).Create(
  	"ExampleCollection.MySecret", {
  		"Secret":{"user":"neal","password":"my_secret_password"}
  })
  	
  // update the password: 
  set status = ##class(%Wallet.KeyValue).Modify(
  	"ExampleCollection.MySecret", {
  		"Secret":{"user":"neal","password":"my_new_password"}
  })
   	
  // udpate the password using array syntax:
  set props("Secret") = {"user":"neal", "password":"my_newer_password"}
  set status = ##class(%Wallet.KeyValue).Modify("ExampleCollection.MySecret", .props)
  

Property Inventory

Method Inventory

Properties

property Name as %String (MAXLEN = 128, PATTERN = "1(1""%"",1A).(1AN,1""-"",1""_"")1""."".(1AN,1""-"",1""_"",1""."")") [ Required ];
Name of the secret. This is used to identify the secret in the Create(), Modify() and Delete() methods. This may only contain alphanumeric characters or ".", "_" or "-", and may start with a "%".
Property methods: NameDisplayToLogical(), NameGet(), NameGetStored(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize()
property Secret as %String) [ Transient ];
Input only. The secret value to store. The format will vary depending on the secret type.
Property methods: SecretDisplayToLogical(), SecretGet(), SecretIsValid(), SecretLogicalToDisplay(), SecretLogicalToOdbc(), SecretNormalize(), SecretSet()
property Secret64 as %String) [ Transient ];
Input only. The secret value to store, expressed as a base 64 encoded string.
Property methods: Secret64DisplayToLogical(), Secret64Get(), Secret64IsValid(), Secret64LogicalToDisplay(), Secret64LogicalToOdbc(), Secret64Normalize(), Secret64Set()

Methods

classmethod Copy(name As %String, newName As %String) as %Status
Create a copy of the secret named name with the name newName. This performs a deep copy. The properties and secret value are copied to the new secret.
classmethod Create(name As %String, ByRef properties As %Any) as %Status
Create a secret with the given name and property values.

name must be a valid, unique name.

properties defines a set of key-value pairs defining the metadata for each secret and/or the secret value. These may be specified as a subscripted array or as a dynamic object.
classmethod Delete(name As %String) as %Status
Delete the named secret.
classmethod Exists(name As %String, obj As %Wallet.Secret, sc As %Status) as %Boolean
Returns true if the named secret exists.
If true, a reference to the secret will be returned in obj.
If false sc will contain the error details.
classmethod GetSecretValue(name As %String) as %String
Returns the value of the stored secret. This method requires %Admin_Wallet:USE. If successful the secret value will be returned. On error an exception will be thrown.
classmethod Modify(name As %String, ByRef properties As %Any) as %Status
Modify a secret with the given name and updated property values.

name must be a valid name referencing an existing Secret.

properties defines a set of key-value pairs defining the metadata for each secret and/or the secret value. These may be specified as a subscripted array or as a dynamic object.
method NameSet(val) as %Status

Indexes

index (NameIdx on Name) [IdKey, Type = key];
Index methods: NameIdxCheck(), NameIdxDelete(), NameIdxExists(), NameIdxOpen(), NameIdxSQLCheckUnique(), NameIdxSQLExists(), NameIdxSQLFindPKeyByConstraint(), NameIdxSQLFindRowIDByConstraint()

Inherited Members

Inherited Methods

Storage

Gray indicates storage defined by superclasses.

Storage Model: Storage (%Wallet.Secret)

^|$$$SecurityMapWallet|WALLET("SecretD")(ID)
=
%%CLASSNAME
Storage
Collection
Version

Subclasses

FeedbackOpens in a new tab